Capture manual gateway after authorization

paypal
manualgateway

#1

I’m implementing a manual gateway (i.e. PayPal). First, I authorize the order:

moltin.Orders.Payment(<order_id>, {
    gateway: 'manual',
    method: 'authorize'
});

After I get a success callback from PayPal, I would like to automatically capture it. So I try with this:

moltin.Orders.Payment(<order_id>, {
    gateway: 'manual',
    method: 'capture'
});

What I get is:

{
    status: 409,
    title: 'Order Complete',
    detail: 'This order is already complete.'
}

Perhaps I’m misunderstanding something, but isn’t this suppose to work?

I’m just trying to do this automatically, so my commerce team doesn’t have to capture every order manually on the dashboard.


#2

Hi @alex

Since we support multiple payments and transactions per order, you can authorize multiple payments via multiple vendors and capture any one of these to mark the order as complete.

That’s why you are receiving Order Complete when you try to post capture. The order is marked as processing and payment authorized.

To capture that manual payment you will need to capture the individual transaction. You can do this via the Dashboard or via cURL as shown below.

curl -X POST https://api.moltin.com/v2/orders/{ORDER_ID}/transactions/{TRANSACTION_ID}/capture \
     -H "Authorization: Bearer XXXX"

You can get a list of all the transactions for an Order by calling the following…

curl -X GET https://api.moltin.com/v2/orders/{ORDER_ID}/transactions \
     -H "Authorization: Bearer XXXX"

I hope this helps :smile:


#3

@notrab Thank you. As usual, very helpful :smiley: