Adding order management to your hosted payment gateway
The Hosted Payment SDK has order management features that allow merchants who use your gateway to capture, refund, and void payments for orders in the Shopify admin. To add order management features to your gateway integration, you should already have created a gateway integration with the Hosted Payments SDK.
Capture payments
Anchor link to section titled "Capture payments"When a merchant decides to capture a transaction in the Shopify admin, Shopify sends the Request Values to your app, with the x_transaction_type
set to capture
:
Key | Type | Example |
---|---|---|
x_transaction_type |
fixed choice | capture |
Your app needs to send back the Response Values with the x_transaction_type
set to capture
:
Key | Type | Example |
---|---|---|
x_transaction_type |
fixed choice | capture |
How a manual capture works
Anchor link to section titled "How a manual capture works"The merchant clicks the capture button on an order page in the Shopify admin.
Shopify sends a POST JSON request to your capture URL with the Request Values.
Your server posts a callback to
x_url_callback
with the Response Values.
Set up manual capture for your merchants
Anchor link to section titled "Set up manual capture for your merchants"To set your capture URL:
Log in to the Partner Dashboard.
Click Payment gateways.
Click the name of your payment gateway.
On your payment gateway's page, click Edit gateway settings.
In the Payment URLs section, enter the url of your gateway's capture endpoint in the Capture URL field.
When a merchant makes a capture in the Shopify admin, Shopify will send the Request Values to your Capture URL.
Refund payments
Anchor link to section titled "Refund payments"When a merchant decides to refund a transaction in the Shopify admin, Shopify sends the Request Values to your app, with the x_transaction_type
set to refund
:
Key | Type | Example |
---|---|---|
x_transaction_type |
fixed choice | refund |
Your app needs to send the Response Values to Shopify with the x_transaction_type
set to refund
:
Key | Type | Example |
---|---|---|
x_transaction_type |
fixed choice | refund |
How a refund works
Anchor link to section titled "How a refund works"The merchant clicks the refund button on an order page in the Shopify admin.
Shopify sends a POST JSON request to your refund url with the Request Values.
Your server posts a callback to
x_url_callback
with the Response Values.
Set up refunds for your merchants
Anchor link to section titled "Set up refunds for your merchants"To set your refund URL:
Log in to the Partner Dashboard.
Click Payment gateways.
Click the name of your payment gateway.
On your payment gateway's page, click Edit gateway settings.
In the Payment URLs section, enter the url of your gateway's capture endpoint in the Refund URL field.
When a merchant gives a refund from the Shopify admin, the Request Values will be sent to your Refund URL.
Void payments
Anchor link to section titled "Void payments"When a merchant decides to capture a transaction in the Shopify admin, Shopify sends the Request Values to your app, with the x_transaction_type
set to void
:
Key | Type | Example |
---|---|---|
x_transaction_type |
fixed choice | void |
Then, your app needs to send the Response Values to Shopify, with the x_transaction_type
set to refund
:
Key | Type | Example |
---|---|---|
x_transaction_type |
fixed choice | refund |
How a void works
Anchor link to section titled "How a void works"The merchant clicks the cancel button on an order page in the Shopify admin.
Shopify sends a POST JSON request to your void url with the Request Values.
Your server posts a callback to
x_url_callback
with the Response Values.
Set up voids for your merchants
Anchor link to section titled "Set up voids for your merchants"To set up your void URL:
Log in to the Partner Dashboard.
Click Payment gateways.
Click the name of your payment gateway.
On your payment gateway's page, click Edit gateway settings.
In the Payment URLs section, enter the url of your gateway's capture endpoint in the Void URL field.
When a merchant gives a refund from the Shopify admin, the Request Values will be sent to your Void URL.