New to the community? Welcome! Please read our Community Rules and Guidelines
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');
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.
©1999-2019 PayPal, Inc. All rights reserved.