PayPal Smart button: display credit card fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I am trying to display pre-filled credit card fields, however, then I define the payer's information in the script, the fields don't get displayed.
Please let me know if you know how to fix this.
Thanks!
Aleksandar
Here is the code I am using:
<script>
paypal.Buttons({
commit: false,
createOrder: function(data, actions) {
// This function sets up the details of the transaction, including the amount and line item details
return actions.order.create({
payer: {
name: {
given_name: "PayPal",
surname: "Customer"
},
address: {
address_line_1: '123 ABC Street',
address_line_2: 'Apt 2',
admin_area_2: 'San Jose',
admin_area_1: 'CA',
postal_code: '95121',
country_code: 'US'
},
email_address: "emailatdomain.com",
phone: {
phone_type: "MOBILE",
phone_number: {
national_number: "14082508100"
}
}
},
purchase_units: [{
amount: { value: '20' }
}],
application_context : {
shipping_preference: "NO_SHIPPING"
},
});
},
onCancel: function (data) {
// Show a cancel page, or return to cart
},
onApprove: function(data, actions) {
// This function captures the funds from the transaction
return actions.order.capture().then(function(details) {
// This function shows a transaction success message to your buyer
alert('Thanks for your purchase!');
});
},
style: {
layout: 'vertical',
color: 'black',
shape: 'rect'
}
}).render('#paypal-button-container');
</script>
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Using Paypal Smart Buttons for checkout sometimes fails with Debit/ Credit Cards Form in Braintree Client-side Integration (JS, iOS, Android SDKs)
- User is asked for shipping address when creating a credit card order in REST APIs
- The Advanced Credit Card Option from PayPal Advanced Checkout SDK is displaying different UIs. in PayPal Upgrade Community
- How to redirect user to paypal checkout form for card payment? in PayPal Payments Standard
- Address not passed to paypal form. in SDKs