Hosted Payment SDK: Order Management Request from Shopify

jmmc
Tourist
9 0 2

We are testing manual capture of payments on our payment gateway. After setting the Payment Capture parameter on the Store to “Manually”, we are not seeing the x_transaction_type header arrive on the request to our gateway. Without this parameter we can’t process the transaction as an authorization without capture since we can’t determine by the headers sent that this is the setting used in Shopify. The capture, void and refund URL’s on the gateways were also set, but we still don’t get the transaction request at checkout

 

Here’s the details for this test we just ran:

 

x_shop_name: AzulTestStore

x_reference: 12522592370749

x_invoice: %2312522592370749

 

Our gateway setup:

shopify1.pngshopify2.png

 

 

 

 

 

 

 

 

 

 

 

 

Payment capture set to Manually capture payments for orders:

 

shopify3.png

 

 

Checkout with our gateway and redirection:

 

shopify5.pngshopify4.png

 

we receive the usual headers, but no x_transaction_type indicating we should authorize only instead of capture (raw form data attached):

 

shopify6.png

 

Request headers:

 

Source:
x_reference=12522592370749&x_account_id=99999991&x_amount=1250.00&x_currency=DOP&x_url_callback=https%3A%2F%2Fazulteststore.myshopify.com%2Fservices%2Fping%2Fnotify_integration%2Fazul_sdp%2F28053471293&x_url_complete=https%3A%2F%2Fazulteststore.myshopify.com%2F28053471293%2Fcheckouts%2Fd1ceb0bb0a4417a1cbb6d1f4c960c77d%2Foffsite_gateway_callback&x_shop_country=DO&x_shop_name=AzulTestStore&x_test=true&x_customer_first_name=Daniel&x_customer_last_name=Harel&x_customer_phone=%2B16286667000&x_customer_billing_country=US&x_customer_billing_city=NY&x_customer_billing_address1=155+India+St&x_customer_billing_address2=2R&x_customer_billing_state=NY&x_customer_billing_zip=11222&x_customer_shipping_country=US&x_customer_shipping_first_name=Daniel&x_customer_shipping_last_name=Harel&x_customer_shipping_city=NY&x_customer_shipping_address1=155+India+St&x_customer_shipping_address2=2R&x_customer_shipping_state=NY&x_customer_shipping_zip=11222&x_invoice=%2312522592370749&x_description=AzulTestStore+-+%2312522592370749&x_url_cancel=https%3A%2F%2Fazulteststore.myshopify.com%2F28053471293%2Fcheckouts%2Fd1ceb0bb0a4417a1cbb6d1f4c960c77d%3Fkey%3Da3ae8ccdb99e2948945a4f5026fc3965&x_signature=5a00a02f1b29eb3d8ebd5314c539c65b48f154471a00790a38f28d399880b5b6

Readable:
x_reference: 12522592370749
x_account_id: 99999991
x_amount: 1250.00
x_currency: DOP
x_url_callback: https%3A%2F%2Fazulteststore.myshopify.com%2Fservices%2Fping%2Fnotify_integration%2Fazul_sdp%2F28053471293
x_url_complete: https%3A%2F%2Fazulteststore.myshopify.com%2F28053471293%2Fcheckouts%2Fd1ceb0bb0a4417a1cbb6d1f4c960c77d%2Foffsite_gateway_callback
x_shop_country: DO
x_shop_name: AzulTestStore
x_test: true
x_customer_first_name: Daniel
x_customer_last_name: Harel
x_customer_phone: %2B16286667000
x_customer_billing_country: US
x_customer_billing_city: NY
x_customer_billing_address1: 155+India+St
x_customer_billing_address2: 2R
x_customer_billing_state: NY
x_customer_billing_zip: 11222
x_customer_shipping_country: US
x_customer_shipping_first_name: Daniel
x_customer_shipping_last_name: Harel
x_customer_shipping_city: NY
x_customer_shipping_address1: 155+India+St
x_customer_shipping_address2: 2R
x_customer_shipping_state: NY
x_customer_shipping_zip: 11222
x_invoice: %2312522592370749
x_description: AzulTestStore+-+%2312522592370749
x_url_cancel: https%3A%2F%2Fazulteststore.myshopify.com%2F28053471293%2Fcheckouts%2Fd1ceb0bb0a4417a1cbb6d1f4c960c77d%3Fkey%3Da3ae8ccdb99e2948945a4f5026fc3965
x_signature: 5a00a02f1b29eb3d8ebd5314c539c65b48f154471a00790a38f28d399880b5b6

We are following the guidelines from these links:

 

https://shopify.dev/tutorials/add-order-management-to-hosted-payment-gateway

 

Also looking at the fields that apply when order management is being used:

 

https://shopify.dev/docs/hosted-payment-sdk/reference/request-values

https://shopify.dev/docs/hosted-payment-sdk/reference/response-values

 

Thanks in advance!!

_JB
Shopify Staff
Shopify Staff
750 86 163

Hey @jmmc,

See the last section in this doc: https://shopify.dev/docs/hosted-payment-sdk/getting-started#why-am-i-receiving-empty-order-managemen...

Payment requests to your integration have their parameters stored in the URL as query string parameters, butorder managementrequests have their parameters stored within the request body instead. When your gateway processes order management requests, make sure that it reads the request body.

Can you confirm you're reading the request body for order management requests?

JB | Developer Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
jmmc
Tourist
9 0 2

hello,

yes we are. thing is that request does not comes any different as if merchant were not using order management, in terms of fields I mean.

 

It looks like I have to configure on my side if merchant tells me he is using order management so I can process a preauth instead of a normal sale.

0 Likes
smadeja
Tourist
4 0 1

Hi @jmmc! Have you managed to figure this out? I'm having the exact same issue.

0 Likes
IgorWC
Tourist
4 0 0

Hi @jmmc  . Did you get anywhere with this issue? We are working on the Hosted Payment integration, and have the exact same problem.

0 Likes
IgorWC
Tourist
4 0 0

@_JB  are you able to help here please? As stated in the Hosted Payment documentation, the x_transaction_type field is not included into the checkout request, thus it seems like there are no fields that would allow to separate request with automatic capturing from ones that require manual capturing. Even HTTP header would be fine, but presently both request are absolutely identical, no indication there.

0 Likes
IgorWC
Tourist
4 0 0

Any help here please?

0 Likes
_JB
Shopify Staff
Shopify Staff
750 86 163

@IgorWC Can you confirm that you're using order management, and reading the request body (not query string params)?

From our docs:

> Payment requests to your integration have their parameters stored in the URL as query string parameters, but order management requests have their parameters stored within the request body instead. When your gateway processes order management requests, make sure that it reads the request body.

If you can confirm that you're reading the request body for order management requests, but the field is still missing, please provide some example checkout URLs and we can investigate further.

JB | Developer Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
smadeja
Tourist
4 0 1

Hey, @IgorWC! I've been struggling with this issue for quite some time, and I can offer you some of my findings. Shopify does not send anything in those requests that would allow you to differentiate between automatic and manual captures, but there's a way to make your hosted payment integration work with this setting. There are two important points to this:

  1. Shopify will use the response from your gateway to set the payment status. If you respond with x_transaction_type equal to authorization, the order will get marked as Authorized (regardless of what Payment capture is set to)
  2. The Payment capture setting on Shopify controls what happens after the payment has been authorised. If it's set to manually, nothing will happen—Shopify will assume that it's the user who should trigger the capture. But if it's set to automatically, Shopify will initialise the capture on its own, immediately issuing another request to your gateway

So, what you can try doing is always authorising the payment first and replying with x_transaction_type set to authorization to the initial Shopify request. The Payment capture setting is going to control whether you want Shopify to be sending capture requests for those payments automatically

0 Likes
smadeja
Tourist
4 0 1

Hey, @IgorWC! I've been struggling with this issue for quite some time, and I can offer you some of my findings. Shopify does not send anything in those requests that would allow you to differentiate between automatic and manual captures, but there's a way to make your hosted payment integration work with this setting. There are two important points to this:

  1. Shopify will use the response from your gateway to set the payment status. If you respond with x_transaction_type equal to authorization, the order will get marked as Authorized (regardless of what Payment capture is set to)
  2. The Payment capture setting on Shopify controls what happens after the payment has been authorised. If it's set to manually, nothing will happen—Shopify will assume that it's the user who should trigger the capture. But if it's set to automatically, Shopify will initialise the capture on its own, immediately issuing another request to your gateway

So, what you can try doing is always authorising the payment first and replying with x_transaction_type set to authorization to the initial Shopify request. The Payment capture setting is going to control whether you want Shopify to be sending capture requests for those payments automatically