Skip to content

Getting Started

This guide walks you through integrating TransactCore payments into your ecommerce application.

Prerequisites

  • An OAuth client registered with the Identity API
  • A connected Stripe account configured in TransactCore for your organization
  • Stripe.js loaded in your frontend

Step 1: Obtain an Access Token

Request an OAuth token from the Identity service with TransactCore scopes:

bash
curl -X POST https://identity.retailsuccessplatform.com/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=${CLIENT_ID}" \
  -d "client_secret=${CLIENT_SECRET}" \
  -d "scope=transactcore:payment-intents.read transactcore:payment-intents.create"
json
{
  "token_type": "Bearer",
  "expires_in": 3600,
  "access_token": "eyJhbGciOiJSUzI1NiIs..."
}

Store this token securely on your backend. All TransactCore API calls should be made server-side — never expose your access token to the browser.

Step 2: Fetch Stripe Config

Before mounting Stripe Elements, retrieve the Stripe publishable key (and optional connected account ID) from TransactCore:

bash
curl https://api.transactcore.retailsuccessplatform.com/api/v1/ecommerce/config/stripe \
  -H "Authorization: Bearer ${TOKEN}"
json
{
  "publishable_key": "pk_live_xxxxx",
  "stripe_account_id": "acct_xxxxx"
}

Pass the publishable_key to your frontend to initialize Stripe.js. If stripe_account_id is present, use it as on_behalf_of in the Payment Element for Stripe Connect mode.

Step 3: Initialize Stripe.js on the Client

javascript
import { loadStripe } from '@stripe/stripe-js';

// Initialize Stripe with the publishable key from TransactCore
const stripe = await loadStripe(publishableKey);

// Mount the Payment Element
const elements = stripe.elements({
  mode: 'payment',
  amount: orderTotalInCents,
  currency: 'usd',
});

const paymentElement = elements.create('payment', { layout: 'tabs' });
paymentElement.mount('#payment-element');

Step 4: Create a Payment Intent

When the customer is ready to pay, create a PaymentIntent from your backend:

bash
curl -X POST https://api.transactcore.retailsuccessplatform.com/api/v1/ecommerce/payment-intents \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "org_00000k1L2m3N4o5",
    "amount": 3420,
    "currency": "usd",
    "metadata": {
      "order_type": "takeout"
    }
  }'
json
{
  "client_secret": "pi_3abc123_secret_xyz789",
  "payment_intent_id": "pi_3abc123",
  "publishable_key": "pk_live_xxxxx",
  "amount": 3420,
  "currency": "usd"
}

Send the client_secret to your frontend. The payment_intent_id should be stored on your backend for order tracking.

Step 5: Confirm the Payment

On the frontend, use Stripe.js to confirm the payment with the client_secret:

javascript
const { error, paymentIntent } = await stripe.confirmPayment({
  elements,
  clientSecret: clientSecret, // from Step 4
  confirmParams: {
    payment_method_data: {
      billing_details: {
        name: customerName,
        email: customerEmail,
      },
    },
    return_url: window.location.href,
  },
  redirect: 'if_required',
});

if (error) {
  // Show error to customer (e.g., card declined)
  console.error(error.message);
} else if (paymentIntent.status === 'succeeded') {
  // Payment successful — submit the order
  await submitOrder(paymentIntent.id);
}

Step 6: Submit the Order

After successful payment confirmation, submit the order to your backend with the payment_intent_id:

javascript
const response = await fetch('/api/orders', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    payment_intent_id: paymentIntent.id,
    items: cart.items,
    customer: { name: customerName, email: customerEmail },
  }),
});

If order creation fails, cancel the payment intent to release the hold on the customer's card:

bash
curl -X POST https://api.transactcore.retailsuccessplatform.com/api/v1/ecommerce/payment-intents/pi_3abc123/cancel \
  -H "Authorization: Bearer ${TOKEN}"

Next Steps


Changelog
DateChange
2026-03-19Added connected account lookup endpoint and fixed scope format.
2026-03-19Initial publication.

ShopHero CommerceCore Platform