Since I am using draft order api in my app so my product can't be passed as a subscription , so I decided to create subscription draft contract at order create webbook . But can't able to get customer payment method , can you kindly help how can I get customer payment method to pass in subscription draft contract ?I tried using customer_payment_methods/create webhook but quite unsure when it will get actually fired , as I tried test by doing one order from customer account as well .
You are correct that we don't support creating a draft order with a subscription. I think capturing the "orders/create" webhook is too late for your use case, since the order is already created at that point, and you won't be able to add anything to it. The "customer_payment_methods/create" webhook fires when a buyer agrees to a subscription during checkout, and pays with a payment method supported for subscriptions. It doesn't sound like that would work for you, either, because you don't have a subscription on the draft order.
If you don't need to initiate this with the "orders/create" webhook, and if the customer already has a payment method stored, you could try querying the customer and getting their payment methods, then creating the subscription draft contract, adding the line item, and committing the draft, perhaps?
Let me know if you have further questions or need clarification.
Hi LarryReid ,
Hope you are doing well ..!!
Thank you for replying , your suggestions and understanding my problem .
Actually I had already gone through the "customerPaymentMethod " QueryRoot , and it specifics to get the customerPaymentMethod we need to pass the id & customerPaymentMethod Id is the main thing that I am looking for to pass in Create Subscription Draft Contract , to crack the way for shopify draft order subscription line item limitations for now. This is the order object I get in order create webhook & it didn't have anything that I can pass in any of the shopify customer API's .
In fact I also tried to do customerPaymentMethodCreditCardCreate but quite unclear to use it as didn't get the enough material/documentation to read on it . If you can clarify , will this particular mutation create the customerPaymentMethod id if I have customer billing address and customer id ? if yes then order object in order create webhook provide me both but then what about "sessionId" what exactly session id is ? Also , at what point this customerPaymentMethodCreditCardCreate need to be fired or hit ? If you can explain the proper understanding of customerPaymentMethodCreditCardCreate , it may be great help .
Also , I am in doubt what if some customers don't user credit card at checkout then how will I proceed to get customerPaymentMethod Id ?
Waiting for your response ..!!