Pending manual payment creates a transaction but doesn't fire OrderTransaction webhook

eric_moore
Shopify Partner
21 0 22

We set up Purchase Orders as a manual payment method.  When selecting this and checking out, a transaction is created for the order with:

id: 1190005080129

gateway: "Purchase Order"

kind: "sale"

status: "pending"

message: "Pending the Purchase Order payment from the buyer"

 

However, the OrderTransaction/create webhook does NOT fire for this transaction.  Once we mark the order Paid, another transaction is created with:

id: 1190357991489

status: "success"

message:"Marked the Purchase Order payment as received"

parent_id: 1190005080129

 

And with this transaction, the webhook DOES fire.  Is this by design?  What is the logic on which transactions fire the webhook?  Seems like if a txn is created, it should fire the create webhook.

 

Replies 5 (5)

Alex
Shopify Staff
1561 81 341

When an order is created with a transaction on it this does not fire the transactions/create webhook, since the webhook is intended for the event where a transaction is added to an existing order via a create request. This is why you see it on the capture transaction. For these cases, orders/create would likely serve you better. I was running into this recently with someone else which gave me a chance to confirm that this is intended.

 

Cheers.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

eric_moore
Shopify Partner
21 0 22

Alex - thanks for the reply.  I'm still a little confused because when we place a credit card order (on bogus gateway), the initial authorize transaction fires the transactions/create webhook.  Doesn't this also qualify as an order being created with a transaction on it?  Then, when we manually capture funds for that transaction, we also see the webhook fire.  In fact, when we simulate a declined credit card, the declined transaction also fires the transactions/create webhook, though not until after a successful transaction gets processed thereby creating the order.

 

So I guess I'm just unclear on the timing of all this and what constitutes a stand-alone transaction that fires the webhook vs. a transaction included with a newly created order.  

Alex
Shopify Staff
1561 81 341

Hey Eric - I took some time to do some testing. So this does seem a bit interesting. I was incorrect before in my answer (either my interpretation of a prior answer was off or things changed, I'd guess the former).

 

This seems to be exclusive to cases where orders are created via the checkout with a `pending` transaction on them as you've observed. Processing checkout payments as sales and authorizations, as long as they're completed, seems to in fact definitely trigger the webhooks.

 

Sorry for the misinfo. I'm asking around to get you a more clear definitive answer than the above, so stay tuned.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

011101010101
Visitor
3 0 0

Hi, do you guys have a suggestion on how to deal with this?

I'm in the situation that I have to manually trigger our API for payments with the payment status "pending".

 

We have "Shopify payments" activated and the payment method "Sofort bank transfer" is always "pending", but its 99% safe that the payment will arrive after 1-3 days. Those orders need to be fulfilled immediately too, like the others.

 

Any help would be much appreciated.

011101010101
Visitor
3 0 0

Update for the records of history:

Pending payments can be caught with: order/update.

 

But please be aware that this is a two-sided sword. The Webhook "Order Update" notifies you about everything, even small changes. Prepare to be blasted with notifications, where most of them are of no use, but it seems that this is the only way to handle pending payments.

 

Alternative: order/create

But I'm unsure about this, because there is the possibility of later payment changes which can not be caught.

 

I don't think that this is the way it should be. To my understanding there should be an endpoint to be notified of all payment related transactions.