DevelopersHomeAPI referenceGuidesChangelogMarketplacePartnersCommunityStatus

Take a first payment

From a test key to a paid test payment in about ten minutes.

1. Get a test key

The owner of the account, or anyone they have given the developer role, opens the dashboard's Assistant page, or calls POST /v1/api_keys with {"environment":"test"}. A test key starts sk_test_ and belongs to a sandbox of its own: it never sees a live payment and a live key never sees a test one.

2. Open a payment

curl https://YOUR_API_HOST/v1/payments \
  -H "Authorization: Bearer $CO_API_KEY" \
  -H "Idempotency-Key: order-1042" \
  -H "Content-Type: application/json" \
  -d '{"amount_paise":49900,"method":"link","customer_phone":"+919800000000"}'

Node:

import { Client } from "@commerce-orchestration/server";
const co = new Client({ apiKey: process.env.CO_API_KEY, baseUrl: "https://YOUR_API_HOST" });
const payment = await co.payments.create({ amount_paise: 49900, method: "link", customer_phone: "+919800000000" });

Java:

Client co = Client.builder().apiKey(System.getenv("CO_API_KEY")).baseUrl("https://YOUR_API_HOST").build();
Map<String, Object> payment = co.payments().create(Map.of("amount_paise", 49900, "method", "link", "customer_phone", "+919800000000"));

Amounts are always whole paise. The SDKs are in sdk/node and sdk/java of the repository and are not on npm or Maven Central yet.

3. End it as you like

curl https://YOUR_API_HOST/v1/sandbox/payments/PAYMENT_ID/settle \
  -H "Authorization: Bearer $CO_API_KEY" -H "Content-Type: application/json" \
  -d '{"scenario":"success"}'

GET /v1/sandbox/scenarios names the others. See the sandbox.

4. Fulfil on the webhook

A redirect or an SDK callback is what to show the customer. The signed payment.captured webhook is what fulfils an order. See webhooks.

5. Go live

Read going live, then change the key.