paypal.Button onAuthorize: get Mrs/Mr gender/salutation from payer_info
Martho
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Mar-07-2019
10:48 PM
Hello,
I'm using the paypal-button like this. My problem is that I need to get the gender/salutation (like "Mrs" or "Mr"), but couldn't find a way how to do so. It seems that payment.payer doens't contain this info. Is there any way to get the correct salutatory address for my customers?
paypal.Button.render( { env:'production', locale: 'de_DE', style: { size: 'medium', color: 'gold', shape: 'pill', label: 'checkout' }, payment: function(resolve, reject) { paypal.request.post('create-payment.php'+q, {}) .then(function(data) { if (data.status == 'Ok') { resolve(data.paymentID); } else { reject(data.msg); alert("Error: "+data.msg); } }) .catch(function(err) { reject(err); }); }, onAuthorize: function(data, actions) { actions.payment.get() .then(function(payment) { var data = payment.payer; data['paymentID'] = payment.id; $.ajax( { type:'POST', url: '/fetchuserdata.php', data: data, cache: false, dataType: 'json', success: function(data, textStatus) { if (data.status == "Ok") { document.location.href = "/continue-checkout.php"; } else { alert("Error: "+data.msg); } }, error: function( jqXHR, textStatus, errorThrown ) { alert('Connection-Error: '+textStatus+' '+errorThrown); } }); }); }, onCancel: function() { // Do nothing } }, '#paypal-express-button');
Labels:
- Labels:
-
Payments REST APIs
1 REPLY 1
sharpiemarker
Esteemed Advisor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar-07-2019
10:51 PM
PayPal does not ask for gender of a user as part of the account info. PayPal simply greets users by the name given in their PayPal account.
Kudos & Solved are greatly appreciated. 🙂
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Can't Save PayPal for purchase later with the Javascript SDK, unable to pass setup token in SDKs
- Invalid selector error when PayPalButtons is rendered in SDKs
- Implement user logout after payment completed with PayPalButtons in SDKs
- How to create the order on the server when using the PayPalButtons component in react? in Sandbox Environment
- How to hide PayPal button in SDKs