API Docs
/
No Results Found
Payment Method Session

Payment Method Session

A payment method session is a temporary, secure session created to collect and store a customer's payment method. It doesn't initiate a charge but ensures the payment method is tokenized and safely linked to the customer's profile.

Download Payment Method Session OpenAPI Document
End Points

Attribute

payment_method_session_id
string
A unique identifier for the payment method session.
customer_id
string
A unique identifier for the customer.
description
string
Description of the payment method session.
created_time
long
The timestamp (milliseconds) indicating when the payment method session was created.

Example

{ "payment_method_session_id": "1987000000724209", "customer_id": "1987000000724207", "description": "Payment method session for customer 1987000000724207", "created_time": 1708950672 }

Create Payment Method Session

This API endpoint allows you to create a payment method session for a customer to collect their payment method details securely.
OAuth Scope : ZohoPay.paymentmethods.CREATE

Arguments

customer_id
string
(Required)
A unique identifier for the customer.
description
string
Description of the payment method session.

Query Parameters

account_id
long
(Required)
The Zoho Payments account ID.

Request Example

Click to copy
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}"); Request request = new Request.Builder() .url("https://payments.zoho.com/api/v1/paymentmethodsessions?account_id=23137556") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute();
const options = { method: 'POST', headers: { Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f', 'content-type': 'application/json' }, body: '{"field1":"value1","field2":"value2"}' }; fetch('https://payments.zoho.com/api/v1/paymentmethodsessions?account_id=23137556', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
import http.client conn = http.client.HTTPSConnection("payments.zoho.com") payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}" headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f", 'content-type': "application/json" } conn.request("POST", "/api/v1/paymentmethodsessions?account_id=23137556", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
const http = require("https"); const options = { "method": "POST", "hostname": "payments.zoho.com", "port": null, "path": "/api/v1/paymentmethodsessions?account_id=23137556", "headers": { "Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f", "content-type": "application/json" } }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.write(JSON.stringify({field1: 'value1', field2: 'value2'})); req.end();
curl --request POST \ --url 'https://payments.zoho.com/api/v1/paymentmethodsessions?account_id=23137556' \ --header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \ --header 'content-type: application/json' \ --data '{"field1":"value1","field2":"value2"}'

Body Parameters

Click to copy
{ "customer_id": "1987000000724207", "description": "Payment method session for customer 1987000000724207" }

Response Example

{ "code": 0, "message": "success", "payment_method_session": { "payment_method_session_id": "1987000000724209", "customer_id": "1987000000724207", "description": "Payment method session for customer 1987000000724207", "created_time": 1708950672 } }

Retrieve Payment Method Session

This API endpoint allows you to retrieve the details of a specific payment method session.
OAuth Scope : ZohoPay.paymentmethods.READ

Path Parameters

payment_method_session_id
long
(Required)
A unique identifier for the payment method session.

Query Parameters

account_id
long
(Required)
The Zoho Payments account ID.

Request Example

Click to copy
OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://payments.zoho.com/api/v1/paymentmethodsessions/731000001449003?account_id=23137556") .get() .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute();
const options = { method: 'GET', headers: { Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' } }; fetch('https://payments.zoho.com/api/v1/paymentmethodsessions/731000001449003?account_id=23137556', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
import http.client conn = http.client.HTTPSConnection("payments.zoho.com") headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" } conn.request("GET", "/api/v1/paymentmethodsessions/731000001449003?account_id=23137556", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
const http = require("https"); const options = { "method": "GET", "hostname": "payments.zoho.com", "port": null, "path": "/api/v1/paymentmethodsessions/731000001449003?account_id=23137556", "headers": { "Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" } }; const req = http.request(options, function (res) { const chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { const body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.end();
curl --request GET \ --url 'https://payments.zoho.com/api/v1/paymentmethodsessions/731000001449003?account_id=23137556' \ --header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'

Response Example

{ "code": 0, "message": "success", "payment_method_session": { "payment_method_session_id": "1987000000724209", "customer_id": "1987000000724207", "status": "succeeded", "payment_method": { "payment_method_id": "1987000000724215", "type": "card", "status": "active", "created_time": 1708950672 } } }