veritrans / veritrans.github.io

Veritrans documentation
http://veritrans.github.io
7 stars 15 forks source link

Information on Recurring Payments / Subscriptions missing #128

Closed philippzentner closed 4 years ago

philippzentner commented 5 years ago

As SaaS business I need more information on recurring payments.

How do I enable a recurring MID and is this only available for credit card payments or can I also issue subscriptions for bank payments (e.g. via debit advice procedures)?

rizdaprasetya commented 5 years ago

Hi @philippzentner Recurring MID is activated depends on Business agreement, and if the bank issued recurring MID to your business.

Recurring capability for now is limited to card transaction only (credit/debit). Not all bank/payment provider have standardized auto-debit procedure unfortunately in Indonesia.

For more detail it's better to consult with our business team at activation[at]midtrans.com

philippzentner commented 4 years ago

Hey @rizdaprasetya, thanks for your reply.

I still struggle to implement the subscription/recurring payment flow. Right now we're doing this:

  1. We let the user choose to pay "comfortably" via credit card or with something else

  2. Generate a Snap Token. If they chose credit card the transaction details contain _creditcard.save and _creditcard.secure and a unique and never publicly exposed 16-digit _userid.

  3. We then use SnapJS to display the payment form

  4. We're waiting for the notification webhook to confirm the payment and set the payment status in our database accordingly

  5. Now I would like to make a subscription request!? Not sure how and when to turn it into a real subscription if the user chose credit card. For the subscription-create request I need a "saved_token_id" but when I use SnapJS, I only get _orderid, _transactionstatus and _statuscode.

I like that you seperated the Snap-Documentation and the API documentation but please make sure that the topic "subscription" is handled appropriately.

Our goal is: 1) People who are willing to pay by credit card can do so and get a real recurring subscription. 2) People who are not willing to pay by credit card get frequent reminders that their subscription is soon running out and needs to be renewed.

rizdaprasetya commented 4 years ago

Hi @philippzentner Agree that we could do better on documenting this use case, we are planning major docs revamp which planned to also include this specific section of recurring/subscription transaction.

Thanks for explaining your current flow, your flow is correct, until this:

  1. Now I would like to make a subscription request!? Not sure how and when to turn it into a real subscription if the user chose credit card. For the subscription-create request I need a "saved_token_id" but when I use SnapJS, I only get order_id, transaction_status and status_code.

SnapJS will not return saved_token_id on the frontend JS callback, because it's should not be accessible from frontend (user should not be able to retrieve it). The saved_token_id will be returned on the HTTP notification (or webhook), your notification url (configured on Midtrans dashboard) will receive HTTP notification call, the JSON will contains saved_token_id. So that's where you will be able to find it.

After that, you'll need to use Core API to trigger the next-transaction charge process. The API is /charge expalined here: https://api-docs.midtrans.com/#charge-features

We have flow diagram, (but this diagram does not specifically explain Snap as first-transaction source, you can still refer to step after trigger backend notification from Midtrans)

image

philippzentner commented 4 years ago

Hi @rizdaprasetya thanks a lot! That helped me. I can then also make use of /subscription correct?

rizdaprasetya commented 4 years ago

Yes /subscription endpoint is also available on Core API. But it is recommended if you have your own schedule to charge your customer, to use the API /charge to trigger transaction based on transaction schedule you need.

rizdaprasetya commented 4 years ago

Keeping this issue open as reminder of

TODO:

rizdaprasetya commented 4 years ago

Added to future docs. Check this beta docs link if anyone interested: https://beta-docs.midtrans.com/en/core-api/advanced-features?id=recurringone-click-transaction

Future docs will use that docs. Issue will be closed for now.