Hi,
I'm working on a storefront with both one-time and subscription products, and would like to know best practices for charging both at once.
I have 2 separate functions:
- Charging the card through createTransactionRequest.
- Creating a subscription through ARBCreateSubscriptionRequest.
My checkout page has a form for customer data and CC information. On submit:
- POSTS the information back to itself
- stores it in a SESSION array
- runs either or both functions, depending on what they ordered. If no error codes show up, it goes to a confirmation page.
Further reading indicates that for a more robust system, the Authorize and Capture for a CC charge should be split into separate actions, with the Capture being run only after the Authorize clears. Also, I am unsure of how to integrate such a separation with the SubscriptionRequest.
If I implement seperating the authorize and capture actions, would I be better served by the following pseudocode?
run authorize
if authorize ==success
run capture
if capture == fail
display error type, prompt for correction
prompt to run capture only again
run subscription
if subscription == fail
display error type, prompt for correction
prompt to run subscription only again
if authorize == fail
display error, prompt for correction and to run again.
Thanks in advance for corrections and advice.
01-12-2017 01:01 PM
Hello @BC2016Genomics
One option is to set the createProfile flag for the intial transaction. If it is successful, the response will include a customer profile which you can to create a subscription.
If the initial transaction is unsuccessful, no profile is created.
Richard
01-12-2017 03:12 PM - edited 01-12-2017 03:13 PM
Hi BC2016Genomics,
Are you expecting to have recurring customers for one-time payments? If this is the case I suggest that you consider running everything throug Customer Profiles, please check:
http://developer.authorize.net/api/reference/features/customer_profiles.html
Thanks,
Joy
01-12-2017 03:45 PM
01-12-2017 08:32 PM