How to redirect customer back from offsite payment portal to Shopify checkout with payment details.

How to redirect customer back from offsite payment portal to Shopify checkout with payment details.

Shopify Partner
12 0 0

I have created offsite payment app extension and provide the session url in extension to redirect the customer on payment portal for payment. 

How to redirect customer back to Shopify with payment details?

I have not checkout URL to redirect the customer back.

Kindly help me.


Replies 2 (2)

Shopify Partner
559 17 39



You need to do following


Create a Redirect Endpoint - Setup Payment Gateway - Verify Payment Details-Update Order Status in Shopify-Redirect Customer to Shopify


Code example for redirect point -



const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const axios = require('axios');

app.use(bodyParser.json());'/payment-redirect', async (req, res) => {
    const paymentDetails = req.body; // Assuming the payment gateway sends a POST request with payment details

    // Verify payment details (implement your own verification logic)
    const isValid = verifyPaymentDetails(paymentDetails);

    if (isValid) {
        // Update order status in Shopify
        const orderId = paymentDetails.order_id; // Get order ID from payment details
        const shopifyAccessToken = 'your-shopify-access-token';
        const shopifyStoreUrl = '';

        try {
            await`https://${shopifyStoreUrl}/admin/api/2023-01/orders/${orderId}.json`, {
                order: {
                    id: orderId,
                    financial_status: 'paid'
            }, {
                headers: {
                    'X-Shopify-Access-Token': shopifyAccessToken,
                    'Content-Type': 'application/json'

            // Redirect customer to Shopify
            const checkoutCompleteUrl = `https://${shopifyStoreUrl}/checkout/order/${orderId}/thank_you`;
        } catch (error) {
            console.error('Error updating order status:', error);
            res.status(500).send('Internal Server Error');
    } else {
        res.status(400).send('Invalid Payment Details');

function verifyPaymentDetails(details) {
    // Implement your own verification logic
    return true;

const port = process.env.PORT || 3000;
app.listen(port, () => {
    console.log(`Server is running on port ${port}`);



If you still need help you can contact us

Click here to Contact and Get Shopify Store Help
E-mail -
We are Shopify Experts in India
Google My Business - Ecommerce Small Task
Shopify Partner
12 0 0

Thanks for reply!
I have only one question now. How to get the Order ID from the payment portal because Shopify did not send the order id in the payment session request?
I followed this doc.

Payment session request have request Id not the order Id.