Closed jsgv closed 5 years ago
I realized that you can add customer name via Accept.js.
var secureData = {
cardData: {
// ...
fullName: fullName
}
};
Accept.dispatchData(secureData, function(){});
But I am still unable to set customer email address. How can I set the customer email address?
You would normally set the email of the customer through the CreditCard
object:
$creditCard = new \Omnipay\Common\CreditCard([
'email' => 'foo@example.com',
]);
$response = $gateway->purchase([
'amount' => $amount,
'opaqueDataDescriptor' => $request->input('dataDescriptor'),
'opaqueDataValue' => $request->input('dataValue'),
'card' => $creditCard,
])->send();
Some more details here:
Thanks @judgej ! Yes, I do understand how to do it with a regular card purchase.
But for my case I am using Accept.js in the front end to create a token and then using the token to finalize the purchase. Not sure in which step the email address can be added. Authorize.net's documentation on their website isn't very helpful.
It's exactly as shown: when you submit the purchase details to the gateway. You can collect those details however you like - in the original form with the Accept form, from the back-end user account, from an additional form in the process. But it's for you to do, not the Accept.JS front end. That only concerns itself with what it needs to tokenise a card.
@jsgv Did this thread answer your question? Do we need further examples in the main README so this issue can be closed?
@judgej Yes, example above was more than enough. Thank you.
How can I add customer info while using the Accept.js gateway?
I am currently using the
Accept.dispatchData
method on the Accept.js library to create the opaque data values.And in the backend I use the values.
How can I add customer info to the transaction?
I see the
addBillingData
method on theAIMAbstractRequest
class, but I am not passing any customer info via Accept.js.I am using version 2.6.