cancel
Showing results for 
Search instead for 
Did you mean: 

Create Customer Payment Profile/Subscription with Accept Hosted

I'm sorry if this is a duplicate - I commented on a thread and then realized it might not be viewed.

 

I'm trying to create a subscription using the hosted form. I followed the steps on another thread (create a customer profile from the intial transaction on the hosted form, then create a subscription using the customer profile)

 

However, the subscription requires a customer payment profile in addition to the customer profile, and I cannot see how to create a payment profile from the hosted form transaction. 

 

Does anyone know how I can do this - create a subscription starting with a hosted form transaction?

 

Thanks!!

Stephanie

bonifaceviii
Member
1 ACCEPTED SOLUTION

Accepted Solutions

I'm posting the answer in case someone else could use it.

 

If you are trying to use the Accept hosted forms for creating a subscription, you actually wouldn't use the hosted payment page, described here:

 

https://developer.authorize.net/api/reference/features/accept_hosted.html

 

The correct workflow is, using the api, make a request for a customer profile: createCustomerProfileRequest. All you need is their email address.

 

After getting the profile id from that call, you make a request for a token for the accept hosted add profile form - 

 

Documentation for this form and others is here: 

 

https://developer.authorize.net/api/reference/features/customer_profiles.html

 

I didn't even realize these forms existed. It's hard to find them in google even if you know what you're looking for.

 

You need the customer profile id to get the token for the "add payment profile" form.

 

You handle the response to this form client-side since you are getting the response from the IFrameCommunicator page you set up (it works the same for the payment form or these customer profile type forms). Here's a sample:

 

https://github.com/AuthorizeNet/accept-sample-app/blob/master/IFrameCommunicator.html

 

I then called server-side code to create the subscription with the api - I pass it the customer profile id because honestly I don't know if the form returns the newly created payment profile id. If you have the customer profile id, you can retrieve any existing payment profiles. So, using just the customer profile id, I make a call to get the payment profile id - getCustomerProfileRequest. That call returns all sorts of stuff including the payment profiles. I just grab the first one.

 

Now with the customer profile id and the payment profile id, I can create a subscription - ARBCreateSubscriptionRequest. There are samples out there to help you form the subscription properly.

 

Final note: if you are testing this in the sandbox, you will need to put a 20 second delay between obtaining a payment profile id and obtaining a subscription using the api. The sandbox does not have the resources to handle these transactions real time. Figuring that out cost me several hours.  You can read through this post to confirm, and though it's older, it is still true:

 

https://community.developer.authorize.net/t5/Integration-and-Testing/E00040-when-Creating-Subscripti...

 

You're welcome!

View solution in original post

bonifaceviii
Member
1 REPLY 1

I'm posting the answer in case someone else could use it.

 

If you are trying to use the Accept hosted forms for creating a subscription, you actually wouldn't use the hosted payment page, described here:

 

https://developer.authorize.net/api/reference/features/accept_hosted.html

 

The correct workflow is, using the api, make a request for a customer profile: createCustomerProfileRequest. All you need is their email address.

 

After getting the profile id from that call, you make a request for a token for the accept hosted add profile form - 

 

Documentation for this form and others is here: 

 

https://developer.authorize.net/api/reference/features/customer_profiles.html

 

I didn't even realize these forms existed. It's hard to find them in google even if you know what you're looking for.

 

You need the customer profile id to get the token for the "add payment profile" form.

 

You handle the response to this form client-side since you are getting the response from the IFrameCommunicator page you set up (it works the same for the payment form or these customer profile type forms). Here's a sample:

 

https://github.com/AuthorizeNet/accept-sample-app/blob/master/IFrameCommunicator.html

 

I then called server-side code to create the subscription with the api - I pass it the customer profile id because honestly I don't know if the form returns the newly created payment profile id. If you have the customer profile id, you can retrieve any existing payment profiles. So, using just the customer profile id, I make a call to get the payment profile id - getCustomerProfileRequest. That call returns all sorts of stuff including the payment profiles. I just grab the first one.

 

Now with the customer profile id and the payment profile id, I can create a subscription - ARBCreateSubscriptionRequest. There are samples out there to help you form the subscription properly.

 

Final note: if you are testing this in the sandbox, you will need to put a 20 second delay between obtaining a payment profile id and obtaining a subscription using the api. The sandbox does not have the resources to handle these transactions real time. Figuring that out cost me several hours.  You can read through this post to confirm, and though it's older, it is still true:

 

https://community.developer.authorize.net/t5/Integration-and-Testing/E00040-when-Creating-Subscripti...

 

You're welcome!

bonifaceviii
Member