How to get the authorization value in the Transaction API call

New Member
26 0 0

Hi,

 

I am trying to create a transaction using the Tranaction APIs.

https://help.shopify.com/en/api/reference/orders/transaction#create-2019-10

 

I came across the below payload.

 

{
  "transaction": {
    "kind": "capture",
    "authorization": "authorization-key"
  }
}

Could anyone please tell me what is this authorization key and how to get it?

 

0 Likes
Shopify Staff
Shopify Staff
268 36 41

Hey @agaonkar,

 

An authorization key is attached to a transaction. For example, placing a credit card order, and then getting the transactions, you can obtain an authorization key:

 

25-38-no1f1-3v0db

 

You can use this key to capture the payment:

 

{
  "transaction": {
    "kind": "capture",
    "authorization": "pi_1FXNIyEPcAwGilOet2nEpwU"
  }
}

 

0 Likes
New Member
26 0 0

Hi @scottydont 

Thanks for the reply.

 

Could you please explain me more about the transaction creation? I mean I want to try out the transactions API but I am getting confused with the different ""Kind" types. It is like we have to create multiple transactions with a different value for Kind everytime??

If possible could you please provide me detailed steps to create a transaction(if any) using APIs.

 

Thanks!

 

 

0 Likes
New Member
26 0 0

hi @scottydont 

Could you please provide me the details of transaction APIs? Step by step on how to create a transaction using the APIs.

0 Likes
Shopify Staff
Shopify Staff
268 36 41

Hey @agaonkar,

 

You can find more information on each on the values here.

 

Can you elaborate on what you're building? If you collect the payment in one step, it should be set to 'sale'. If you authorize the payment for collection later, you'll want to use 'authorization' and then a second 'capture' transaction when you capture the payment.

 

An order can have multiple transactions.

0 Likes
New Member
26 0 0

hi @scottydont ,

I have created one order. Now I want to know what are the next set of steps I can perform with this order wrt transactions and payments. Is there any specific order? or is there any ideal way of going about it.

 

Request you to kindly help me understand the flow once the order is created.

 

Thanks!

0 Likes
Highlighted
New Member
26 0 0

Can someone please reply to the below?

 

I have created one order. Now I want to know what are the next set of steps I can perform with this order wrt transactions and payments. Is there any specific order? or is there any ideal way of going about it.

 

Request you to kindly help me understand the flow once the order is created.

 

0 Likes
Shopify Staff
Shopify Staff
268 36 41

Hey @agaonkar,

 

The next step would be to create a transaction for that order. For example:

 

 

POST /admin/api/2019-10/orders/#{order_id}/transactions.json
{
  "transaction": {
    "currency": "USD",
    "amount": "10.00",
    "kind": "sale"
  }
}

Keep in mind you don't have to create transactions. You could just mark the order as paid when you create it ("financial_status": "paid"). How are you collecting payment?

 

 

 

 

0 Likes
New Member
26 0 0

hi @scottydont 

 

I am actually trying to test the APIs so I am not really sure about the payment methods and how to collect them.

Request you to kindly help me understand the process and flow. Just like the way you did it in the previous reply. I see there are various options available for for the field "kind". So please let me know what is the ideal flow.

0 Likes
Shopify Staff
Shopify Staff
268 36 41

In that case, perhaps you could just mark the order as paid and skip adding transactions?

 

Regarding the kind values: if you collect the payment in one step, it should be set to 'sale'. If you authorize the payment for collection later, you'll want to use 'authorization' and then a second 'capture' transaction when you capture the payment

0 Likes