Reply
Member
Posts: 2
Registered: ‎10-03-2017

ARB Subscription webhooks not working

[ Edited ]

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?

Highlighted
Member
Posts: 2
Registered: ‎10-03-2017

Re: ARB Subscription webhooks not working

There's no response to this? Really?

Posts: 333
Kudos: 59
Solutions: 36
Registered: ‎03-13-2017

Re: ARB Subscription webhooks not working

[ Edited ]

Hi @iteachustest1

 

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 . 

 

{"notificationId":"8d9825d1-5cbd-4bfb-9d2c-b7feaf702622","eventType":"net.authorize.customer.subscription.created","eventDate":"2018-05-24T21:54:28.4996155Z","webhookId":"a7369ca9-c1b4-4e30-87c7-b08d6872e480","payload":{"name":"111","amount":12.00,"status":"active","profile":{"customerProfileId":1504570593,"customerPaymentProfileId":1503880282,"customerShippingAddressId":1504016383},"entityName":"subscription","id":"5190021"}}
 
 
 




Send feedback at developer_feedback@authorize.net
Member
Posts: 3
Registered: ‎02-12-2019

Re: ARB Subscription webhooks not working

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

Member
Posts: 3
Registered: ‎02-12-2019

Re: ARB Subscription webhooks not working

[ Edited ]

can anyone please help with above issues?

 

any admin or developer @Anurag , @RichardH@gmokhasi please ?

All Star
Posts: 683
Registered: ‎11-05-2018

Re: ARB Subscription webhooks not working

There are a few ways to do that. One is to set up multiple endpoints and have an endpoint dedicated to ARB transaction and then a separate endpoint or endpoints for whatever else you do. The other way is to use one endpoint and use a getTransactionDetails method call. In the response you could check for the subscription id. If not an ARB transaction then it will be an empty string. If an ARB transaction, I think all of those will have a subscription id. So you could build rules in your app to execute one set of actions if an empty string and another set of actions if there is a subscription Id.

There are probably more ways to do this that I didn’t list, but I believe the above method will work. Turn on transaction reporting in your interface if you haven’t already done so. Then go to the API reference and on the right side there is a shortcut to transaction reporting API functions with sample code. The one you want is getTransactionDetails. Then you just get the transaction Id from the webhook payload and run that script.

And I’m not sure what you’re specifically asking when you say if the credit card is not charged how do you charge the credit card. Unless you’re using an integration where your app captures the entire PAN and stores it on your records (if you do this be aware that PCI compliance is very tough and expensive for this method) then you personally won’t have any way to charge for the initial creation of the subscription, I think. The ARB has a feature where the charge will be attempted more than once if the first one fails. So it will do it for you I think. Once the subscription is initiated, I also think that you can use the subscription Id to charge it. I never use ARB or rather haven’t yet. I’ve just looked over the API docs a little. I believe everything I’ve typed is accurate and will get you started. Some features of the ARB may require you to turn them on. I think that the auto retries feature may be one such feature.
Member
Posts: 7
Registered: ‎03-03-2019

Re: ARB Subscription webhooks not working

[ Edited ]

@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!

 

Member
Posts: 7
Registered: ‎03-03-2019

Re: ARB Subscription webhooks not working

@vipuldumaniya

 

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!

Posts: 2,765
Topics: 57
Kudos: 245
Blog Posts: 67
Registered: ‎12-05-2011

Re: ARB Subscription webhooks not working

[ Edited ]

@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.