Hi @bhumika_dvb ,
When Shopify initiates a payment request and redirects to your payment gateway, it doesn’t include order line items in the HTTP POST request by default. To solve this issue, you can retrieve the order details, including line items, through Shopify’s API.
Here’s how you can get the order line items:
1. Use Shopify’s Admin API: Once Shopify triggers the redirect to your payment gateway, you can use the Shopify Admin API to fetch the order details, including the line items.
You can make a GET request to the orders endpoint using the order ID that is included in the initial request from Shopify.
Example request:
GET /admin/api/2023-01/orders/{order_id}.json
This will return all the details of the order, including the line items. In the response, you’ll find a line_items array with all the product details.
Example response:
{
"order": {
"id": 123456789,
"line_items": [
{
"id": 987654321,
"variant_id": 123456,
"quantity": 2,
"price": "19.99",
"title": "Product Name",
"sku": "ABC123"
}
]
}
}
Ensure You Have API Permissions: Make sure that your payment app has the necessary API permissions to access order details. You may need read_orders permissions to fetch order details.
Handle the Delay: Since there may be a short delay between when the payment request is initiated and when you fetch the order details, ensure that your payment app can handle this latency. You might want to check if the order exists and retry if necessary.
This approach should allow you to get the order line items after the payment request is initiated and send them to the payment gateway.
Let me know if you need more details or further help!