Solved

Billing API, charge only when order completed

Sushilsth
Shopify Partner
9 0 0

Hi,

 

I am new to app development and trying to build a public app where I want to charge the merchant when the customer order is completed. 

 

Here is the flow of my app.

1. App will create one product in the store with a specific amount.

2. By default that product will be added to the cart when the customer reaches the cart page.

3. After the customer checkout and order are completed with the product app created in #1, I need to charge the merchant with the amount of the product that the app created in #1.

 

I have seen billing types with "one-time" and "recurring" in specific interval but it is not what I want. 

 

Any insights on this would be helpful.

 

Thank you

Accepted Solution (1)
alagaesia
Shopify Partner
32 6 10

This is an accepted solution.

You could save the auth token in the shop table, so you can query shopify api whenever you need to (Remember to check the hmac from webhook!)

 

another option would be to keep a DB record for each order, and then at the first day of the month, do one big charge. I don’t know your use case, so it’s hard to help 🙂

Alessandro

View solution in original post

Replies 5 (5)

alagaesia
Shopify Partner
32 6 10
Sushilsth
Shopify Partner
9 0 0

@alagaesia seems like it is what I need. Do you have any insight how can I charge when customer place the order? 

 

I am thinking I can charge when the order_complete webhook is triggered.

Sushilsth
Shopify Partner
9 0 0

I just realized that, it's not possible to charge the merchant from webhooks as it's not possible to authenticate the merchant from webhooks. Do you know any way how to achieve this, basically charge the merchant when an order is created that has my product as an ordered item?

alagaesia
Shopify Partner
32 6 10

This is an accepted solution.

You could save the auth token in the shop table, so you can query shopify api whenever you need to (Remember to check the hmac from webhook!)

 

another option would be to keep a DB record for each order, and then at the first day of the month, do one big charge. I don’t know your use case, so it’s hard to help 🙂

Alessandro
Sushilsth
Shopify Partner
9 0 0

Hello. Thank you for the reply. i am using Osiset PHP package to develop the apps. Do you have any insights how to get the auth token. Does this outh token has expiry date and I also did not found HMAC in webhook response.