Hi There, I'm having some trouble integrating the Express Checkout into my website and i'm finding the help documents confusing. We are trying to add a payment portal for our club memberships. After alot of reading, i thought the Express Checkout product would be the best with the Braintree SDK (but happy to be corrected and use another product if there is a better option). We have multiple options for club membership with different costs, this is handled on our website and the cost can be passed through to PayPal. I have attached snippet of the paypal code, the development site is on my localhost at the moment so i cant send the actual link. This code was generated from PayPal's website in the developer section with small tweaks from me. The code is written into an ASP.NET Control that I have made with a MultiView. The Paypal buttons will show on the site, but when clicked the small PayPal pop up will appear, sometimes it closes after a few seconds, other times it stays open. So my main questions are... Is there anything that i have done below that would cause the pop up to dissappear? I have a Sandbox account setup, but havent bothered with the production keys yet as i cant get it working in a test environment Is there a way to Force the Country when paying? At the moment, when the box appears it selects the United Kingdom (i'm in Australia) <h2>Payment</h2>
<asp:Label ID="lblNamePayment" runat="server" Text="Label"></asp:Label>,<br />
<br />
Thank you for your Membership Application, we look forward to having you involved with our club and looking forward to the racing!<br />
<br />
You're almost done! Payment is now due to complete the process. Click the below button to pay with PayPal on their secure server<br />
<br />
Amount: $<%=sPrice%> (PayPal fees Included - 2.6% + $0.30)<br />
Membership Type: <asp:Label ID="lblPaymentMemberType" runat="server" Text="Label"></asp:Label><br />
<br />
<br />
<div id="paypal-button-container" style="text-align:center"></div>
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<script src="https://js.braintreegateway.com/web/3.11.0/js/client.min.js"></script>
<script src="https://js.braintreegateway.com/web/3.11.0/js/paypal-checkout.min.js"></script>
<script>
// Render the PayPal button
paypal.Button.render({
style: {
layout: 'vertical', // horizontal | vertical
size: 'large', // medium | large | responsive
shape: 'rect', // pill | rect
color: 'black' // gold | blue | silver | black
},
// Pass in the Braintree SDK
braintree: braintree,
// Pass in your Braintree authorization key
client: {
sandbox: paypal.request.get('/demo/checkout/api/braintree/client-token/'),
production: '<insert production auth key>'
},
// Set your environment
env: 'sandbox', // sandbox | production
// Wait for the PayPal button to be clicked
payment: function (data, actions) {
// Make a call to create the payment
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '<%=sPrice%>', currency: 'AUD' }
}
]
}
});
},
// Wait for the payment to be authorized by the customer
onAuthorize: function (data, actions) {
// Call your server with data.nonce to finalize the payment
console.log('Braintree nonce:', data.nonce);
// Get the payment and buyer details
return actions.payment.get().then(function (payment) {
console.log('Payment details:', payment);
});
}
}, '#paypal-button-container');
</script> Thanks in advance for your help!
... View more