Commerce User Payment Methods
Create a commerce user payment method
POST
/
v1
/
commerce_user_payment_methods
Create a commerce user payment method
curl --request POST \
--url https://api.ongoody.com/v1/commerce_user_payment_methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cardholder_name": "John Doe",
"commerce_end_user_id": "test_user_pm_2331d26e",
"payment_method_type": "card",
"interim_card_key": "X9edbacqt1CBCRRKRLkuiINj",
"billing_address": {
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
}
}
'import requests
url = "https://api.ongoody.com/v1/commerce_user_payment_methods"
payload = {
"cardholder_name": "John Doe",
"commerce_end_user_id": "test_user_pm_2331d26e",
"payment_method_type": "card",
"interim_card_key": "X9edbacqt1CBCRRKRLkuiINj",
"billing_address": {
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cardholder_name: 'John Doe',
commerce_end_user_id: 'test_user_pm_2331d26e',
payment_method_type: 'card',
interim_card_key: 'X9edbacqt1CBCRRKRLkuiINj',
billing_address: {
address_1: '123 Main St',
address_2: 'Apt 4B',
city: 'New York',
state: 'NY',
postal_code: '10001',
country: 'US'
}
})
};
fetch('https://api.ongoody.com/v1/commerce_user_payment_methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ongoody.com/v1/commerce_user_payment_methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cardholder_name' => 'John Doe',
'commerce_end_user_id' => 'test_user_pm_2331d26e',
'payment_method_type' => 'card',
'interim_card_key' => 'X9edbacqt1CBCRRKRLkuiINj',
'billing_address' => [
'address_1' => '123 Main St',
'address_2' => 'Apt 4B',
'city' => 'New York',
'state' => 'NY',
'postal_code' => '10001',
'country' => 'US'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ongoody.com/v1/commerce_user_payment_methods"
payload := strings.NewReader("{\n \"cardholder_name\": \"John Doe\",\n \"commerce_end_user_id\": \"test_user_pm_2331d26e\",\n \"payment_method_type\": \"card\",\n \"interim_card_key\": \"X9edbacqt1CBCRRKRLkuiINj\",\n \"billing_address\": {\n \"address_1\": \"123 Main St\",\n \"address_2\": \"Apt 4B\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10001\",\n \"country\": \"US\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ongoody.com/v1/commerce_user_payment_methods")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cardholder_name\": \"John Doe\",\n \"commerce_end_user_id\": \"test_user_pm_2331d26e\",\n \"payment_method_type\": \"card\",\n \"interim_card_key\": \"X9edbacqt1CBCRRKRLkuiINj\",\n \"billing_address\": {\n \"address_1\": \"123 Main St\",\n \"address_2\": \"Apt 4B\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10001\",\n \"country\": \"US\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ongoody.com/v1/commerce_user_payment_methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cardholder_name\": \"John Doe\",\n \"commerce_end_user_id\": \"test_user_pm_2331d26e\",\n \"payment_method_type\": \"card\",\n \"interim_card_key\": \"X9edbacqt1CBCRRKRLkuiINj\",\n \"billing_address\": {\n \"address_1\": \"123 Main St\",\n \"address_2\": \"Apt 4B\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10001\",\n \"country\": \"US\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "7e77b629-5ea9-4bd5-8191-a67a402ccd26",
"card_brand": "mastercard",
"card_last_4": "4444",
"card_exp_month": 12,
"card_exp_year": 2034,
"cardholder_name": "John Doe",
"created_at": "2026-06-03T12:24:05Z"
}Only for the Commerce API.
commerce_end_user_id. Then, use the returned payment method id as the payment_method_id in the Create an Order Batch endpoint along with the commerce_end_user_id.
For more information, refer to Embedded Payment Form.Authorizations
Your Goody API key.
Body
application/json
The name on the card.
The user ID of the user in your app to associate this payment method with.
The type of payment method to create. Currently, only card is supported.
The key for the interim card to use for the payment method.
Show child attributes
Show child attributes
Response
Commerce user payment method created
Brand of the card, e.g. 'Visa' or 'Mastercard'.
Last 4 digits of the card number.
Date and time the payment method was created, ISO 8601 format.
⌘I
Create a commerce user payment method
curl --request POST \
--url https://api.ongoody.com/v1/commerce_user_payment_methods \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cardholder_name": "John Doe",
"commerce_end_user_id": "test_user_pm_2331d26e",
"payment_method_type": "card",
"interim_card_key": "X9edbacqt1CBCRRKRLkuiINj",
"billing_address": {
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
}
}
'import requests
url = "https://api.ongoody.com/v1/commerce_user_payment_methods"
payload = {
"cardholder_name": "John Doe",
"commerce_end_user_id": "test_user_pm_2331d26e",
"payment_method_type": "card",
"interim_card_key": "X9edbacqt1CBCRRKRLkuiINj",
"billing_address": {
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cardholder_name: 'John Doe',
commerce_end_user_id: 'test_user_pm_2331d26e',
payment_method_type: 'card',
interim_card_key: 'X9edbacqt1CBCRRKRLkuiINj',
billing_address: {
address_1: '123 Main St',
address_2: 'Apt 4B',
city: 'New York',
state: 'NY',
postal_code: '10001',
country: 'US'
}
})
};
fetch('https://api.ongoody.com/v1/commerce_user_payment_methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ongoody.com/v1/commerce_user_payment_methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cardholder_name' => 'John Doe',
'commerce_end_user_id' => 'test_user_pm_2331d26e',
'payment_method_type' => 'card',
'interim_card_key' => 'X9edbacqt1CBCRRKRLkuiINj',
'billing_address' => [
'address_1' => '123 Main St',
'address_2' => 'Apt 4B',
'city' => 'New York',
'state' => 'NY',
'postal_code' => '10001',
'country' => 'US'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ongoody.com/v1/commerce_user_payment_methods"
payload := strings.NewReader("{\n \"cardholder_name\": \"John Doe\",\n \"commerce_end_user_id\": \"test_user_pm_2331d26e\",\n \"payment_method_type\": \"card\",\n \"interim_card_key\": \"X9edbacqt1CBCRRKRLkuiINj\",\n \"billing_address\": {\n \"address_1\": \"123 Main St\",\n \"address_2\": \"Apt 4B\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10001\",\n \"country\": \"US\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ongoody.com/v1/commerce_user_payment_methods")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cardholder_name\": \"John Doe\",\n \"commerce_end_user_id\": \"test_user_pm_2331d26e\",\n \"payment_method_type\": \"card\",\n \"interim_card_key\": \"X9edbacqt1CBCRRKRLkuiINj\",\n \"billing_address\": {\n \"address_1\": \"123 Main St\",\n \"address_2\": \"Apt 4B\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10001\",\n \"country\": \"US\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ongoody.com/v1/commerce_user_payment_methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cardholder_name\": \"John Doe\",\n \"commerce_end_user_id\": \"test_user_pm_2331d26e\",\n \"payment_method_type\": \"card\",\n \"interim_card_key\": \"X9edbacqt1CBCRRKRLkuiINj\",\n \"billing_address\": {\n \"address_1\": \"123 Main St\",\n \"address_2\": \"Apt 4B\",\n \"city\": \"New York\",\n \"state\": \"NY\",\n \"postal_code\": \"10001\",\n \"country\": \"US\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "7e77b629-5ea9-4bd5-8191-a67a402ccd26",
"card_brand": "mastercard",
"card_last_4": "4444",
"card_exp_month": 12,
"card_exp_year": 2034,
"cardholder_name": "John Doe",
"created_at": "2026-06-03T12:24:05Z"
}