Setting the Item Name and Donate type with Smart Buttons

Elbonian
Contributor
Contributor

I am attempting to upgrade our PayPal donations page, which uses code that predates both V1 and V2. We are a membership organization, and with that code the email which goes out to our members when they purchase a membership looks like this:

DescriptionUnit priceQtyAmount
Item Name: Membership
Item#
$65.00 USD1$65.00 USD

 

I have I have successfully managed to vary the Unit price (above) according to the membership level selected using radio buttons. And I got the PayPal buttons working with the sandbox using the following code:

 

paypal.Buttons({
createOrder: function(data, actions) {
var ele = document.getElementsByName('amount');
for(var i = 0; i < ele.length; i++) {
if(ele[i].checked) {
var described = 'Membership';
var camount = ele[i].value; // Standard membership donation.
var eleid = ele[i].id;
if (eleid == "5") {
var spec = document.getElementsByName('Samount'); // Special donation  amount
camount = spec[0].value;
described = 'Special donation';
}
}
}
return actions.order.create({
purchase_units: [{  // I can't figure out how to set the item name.
amount: {
value: camount   // this is how I inserted the amount from the radio buttons
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Thank you for your contribution, ' + details.payer.name.given_name);
});
}
}).render('#paypal-button-container'); // Display payment options on your web page

 

But I cannot figure out where to set the item name. And also, our old interface used to use the "Donate" button option, and I cannot find that option in the new code. I have tried to set up purchase_units copying the syntax in the documentation using this code:

 

purchase_units: [{
description: 'Membership',
amount: {
value: '0.01'
}
}]

 

However, whenever I include the "description:" line, the buttons fail to appear. Remove that line and it works just fine.

 

Finally, I have not been able to log into my business sandbox account using the credentials automatically generated for me by PayPal. So, I can't even look at the transactions to see if they work (if/when they work).

 

So, I'm looking for help or suggestions for these issues:

1. Donate instead of purchase button process (even if the button design doesn't change; I don't want to deal with shipping);

2. Setting the Item Name;

3. Logging into the supplied business sandbox account which was automatically created;

 

Any help would be appreciated. Thanks in advance.

Login to Me Too
1 REPLY 1

Elbonian
Contributor
Contributor

I resolved the problem with logging into my sandbox business account. Somehow, the password got corrupted.

 

After logging in, I was able to look at my transactions. Here is an example:

Item number       Description     Quantity     Amount
n/a                       n/a                 1                $1,000.00 USD
 
This represents what the new code does different than the old code. The old code gave us a "Description" and the new code does not. It sure appears that the field is available when the packing slip is printed (which is what gets me to the above). But the code examples do not illustrate how to set anything except the amount. Any ideas?
Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.