I'm using Salesforce to integrate with the API and setup ARB subscriptions for users. I have it set up to send the subscription request to Authorize.Net in an Apex trigger after a Subscription record is inserted - at that time the Subscription is set to "Pending." I want the subscription.created webhook to set that value to "Active" once Authorize.Net creates the subscription. However, I'm getting no webhooks at all for any ARB events. Is this a limitation of the sandbox?
05-23-2018 08:51 AM - edited 05-23-2018 08:53 AM
There's no response to this? Really?
05-24-2018 02:04 PM
I just tested with creating a subscription and was able to recieve the webhook for it.
Can you check if your endpoint is up and running and the webhhook is in Active status ?
You can use the http://webhookinbox.com/ for webhook endpoint testing if needed .
05-24-2018 02:59 PM - edited 05-24-2018 03:00 PM
Hello
I am integrating ARB with one eCommerce application.
1. Customer place initial recurring orders
2. It create new subscription successfully - so when new subscription is created is customer credit card is charged?
3. It called subscription.created event in webhook so here i need to set initial order payment status to paid if authorize has charge the credit card.
if its not charging credit card then what is the way i need to implement to charge credit card as well?
When ARB process next time and charge customer which eventtype will be called in webhook and what will be its payload?
if it calling transaction.authorize or transaction.authcapture etc then how we will be able to differentiate regular transaction and ARB transaction? as when new ARB transaction is created we need to place new order in our system from webhook endpoints
Thank you
Vipul
02-12-2019 01:13 AM
02-12-2019 11:48 PM - edited 02-12-2019 11:56 PM
02-20-2019 12:09 AM
@vipuldumaniya wrote:Hello
I am integrating ARB with one eCommerce application.
1. Customer place initial recurring orders
2. It create new subscription successfully - so when new subscription is created is customer credit card is charged?
3. It called subscription.created event in webhook so here i need to set initial order payment status to paid if authorize has charge the credit card.
if its not charging credit card then what is the way i need to implement to charge credit card as well?
When ARB process next time and charge customer which eventtype will be called in webhook and what will be its payload?
if it calling transaction.authorize or transaction.authcapture etc then how we will be able to differentiate regular transaction and ARB transaction? as when new ARB transaction is created we need to place new order in our system from webhook endpoints
Thank you
Vipul
I use PHP so everything I answer will be PHP related.
1. Create customer profile
2. Customer place initial recurring order and I charge them with a normal AIM call using chargeCreditCard method so the payment is captured immediately, otherwise subscription payments are processed and captured at 2:00am
3. After inital charge with AIM I setup ARB to start in excatly 1 month with a modified version of createSubscriptionFromCustomerProfile that uses Carbon to set the next month like this:
$addMonth = Carbon::now()->addMonth(); $paymentSchedule->setStartDate(new DateTime($addMonth));
4. When webhook comes in for the ARB subscription next month (at 2:00am) it will be type of net.authorize.payment.authcapture.created and will contain the following JSON:
{ "notificationId":"fbf126q4-3a2e-33d1-b218-0e34e05e71b13", "eventType":"net.authorize.payment.authcapture.created", "eventDate":"2019-03-03T08:48:11.2763281Z", "webhookId":"e472be90-f6c9-429f-a2f7-58ac825b5043", "payload":{ "responseCode":1, "authCode":"6U25LG", "avsResponse":"Y", "authAmount":29, "entityName":"transaction", "id":"40026100295" } }
5. I then use getTransactionDetails method to find the subscriptionId and when I convert the payload of that API call to JSON it looks like this:
Convert paylod to JSON with this if you want to store values in a DB or something:
$json = json_encode($response->getTransaction());
And you get...
{ "transId":"40026100295", "submitTimeUTC":"2019-03-03T08:48:11Z", "submitTimeLocal":"2019-03-03T00:48:11Z", "transactionType":"authCaptureTransaction", "transactionStatus":"capturedPendingSettlement", "responseCode":1, "responseReasonCode":1, "subscription":{ "id":5654000, "payNum":1 }, "responseReasonDescription":"Approval", "authCode":"6U25LG", "aVSResponse":"Y", "cardCodeResponse":"P", "authAmount":46580, "settleAmount":46580, "taxExempt":false, "payment":{ "creditCard":{ "cardNumber":"XXXX4242", "expirationDate":"XXXX", "cardType":"Visa" } }, "customer":{ "type":"individual", "id":"M_1551538131", "email":"someguysemail@norealdomain.com" }, "billTo":{ "firstName":"Joe", "lastName":"Johnson", "company":"Souveniropolis", "address":"14 Main Street", "city":"Pecan Springs", "state":"TX", "zip":"44628", "country":"USA", "phoneNumber":"888-888-8888", "faxNumber":"999-999-9999" }, "shipTo":{ "firstName":"James", "lastName":"White", "company":"Addresses R Us", "address":"714051727 North Spring Street", "city":"Honullu", "state":"HI", "zip":"08753", "country":"USA" }, "recurringBilling":false, "product":"Card Not Present", "marketType":"eCommerce" }
-Then I take the JSON and throw it back into an object and get the subscriptionID:
$obj = json_decode($json, true); echo "The SubscriptionId of the transaction is ". $obj['subscription']['id'];
--Note since subscription is private you can't run method $response->getTransaction()->getSubscription()->id to get the subscriptionId, which is why I handled it with the above code.
6. You can then set the customers account in your application to stay active with looking up the customer by email or auth.net customer ID if you set one with:
echo "Auth.Net Customer ID is: ". $obj['customer']['id']; echo "Customer Email: ". $obj['customer']['email'];
Note: Step 2 and 3 are optional and I just deicide to do that so customer gets immediate charge because these days push notifications are set to phones from a customers bank when a charge is made and using AIM is instant for that, using ARB will process it the next day and they will recieve a notification...
Edit: I forgot to say that subscription will be empty if the net.authorize.payment.authcapture.created type came from a regular one time purchase so to chec for that and not get errors you can do something like:
if (!isset($obj['subscription']['id'])) { //payment captured from one time purchase AIM } else { //payment captured from ARB echo $obj['subscription']['id']; }
Cheers!
03-03-2019 08:05 AM - edited 03-03-2019 08:12 AM
Just so you know I spent about 2 hours crafting a very detailed reponse to solve your problem and the auto-moderator took the post down and marked it as SPAM... I have notified the moderators to bring the post back, until then hang tight!
03-03-2019 08:22 AM
@JoeElia I've moved your post back into the forum. Something in your post triggered the SPAM filter, but we do often get false positives.
03-03-2019 10:24 AM - edited 03-03-2019 05:17 PM
Edit: I forgot to say that subscription will be empty if the net.authorize.payment.authcapture.created type came from a regular one time purchase so to chec for that and not get errors you can do something like:
if (!isset($obj['subscription']['id'])) { //payment captured from one time purchase AIM } else { //payment captured from ARB echo $obj['subscription']['id'];
Can someone confirm there is no subscription field on ARB renewals anymore ?
06-04-2024 03:31 AM