curl --request PUT \
--url https://api.sandbox.cheqpay.mx/pos/payment-methods/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-merchant-id: <api-key>' \
--data '
{
"billingFirstName": "John",
"billingLastName": "Doe",
"billingPhoneNumber": "+525512345678",
"billingEmail": "john.doe@example.com",
"billingAddressLine1": "123 Main St",
"billingAddressLine2": "Apt 4B",
"billingCity": "Mexico City",
"billingState": "CDMX",
"billingPostalCode": "12345",
"billingCountry": "MX"
}
'import requests
url = "https://api.sandbox.cheqpay.mx/pos/payment-methods/{id}"
payload = {
"billingFirstName": "John",
"billingLastName": "Doe",
"billingPhoneNumber": "+525512345678",
"billingEmail": "john.doe@example.com",
"billingAddressLine1": "123 Main St",
"billingAddressLine2": "Apt 4B",
"billingCity": "Mexico City",
"billingState": "CDMX",
"billingPostalCode": "12345",
"billingCountry": "MX"
}
headers = {
"x-api-key": "<api-key>",
"x-merchant-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-api-key': '<api-key>',
'x-merchant-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
billingFirstName: 'John',
billingLastName: 'Doe',
billingPhoneNumber: '+525512345678',
billingEmail: 'john.doe@example.com',
billingAddressLine1: '123 Main St',
billingAddressLine2: 'Apt 4B',
billingCity: 'Mexico City',
billingState: 'CDMX',
billingPostalCode: '12345',
billingCountry: 'MX'
})
};
fetch('https://api.sandbox.cheqpay.mx/pos/payment-methods/{id}', 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.sandbox.cheqpay.mx/pos/payment-methods/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'billingFirstName' => 'John',
'billingLastName' => 'Doe',
'billingPhoneNumber' => '+525512345678',
'billingEmail' => 'john.doe@example.com',
'billingAddressLine1' => '123 Main St',
'billingAddressLine2' => 'Apt 4B',
'billingCity' => 'Mexico City',
'billingState' => 'CDMX',
'billingPostalCode' => '12345',
'billingCountry' => 'MX'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-merchant-id: <api-key>"
],
]);
$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.sandbox.cheqpay.mx/pos/payment-methods/{id}"
payload := strings.NewReader("{\n \"billingFirstName\": \"John\",\n \"billingLastName\": \"Doe\",\n \"billingPhoneNumber\": \"+525512345678\",\n \"billingEmail\": \"john.doe@example.com\",\n \"billingAddressLine1\": \"123 Main St\",\n \"billingAddressLine2\": \"Apt 4B\",\n \"billingCity\": \"Mexico City\",\n \"billingState\": \"CDMX\",\n \"billingPostalCode\": \"12345\",\n \"billingCountry\": \"MX\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-merchant-id", "<api-key>")
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.put("https://api.sandbox.cheqpay.mx/pos/payment-methods/{id}")
.header("x-api-key", "<api-key>")
.header("x-merchant-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"billingFirstName\": \"John\",\n \"billingLastName\": \"Doe\",\n \"billingPhoneNumber\": \"+525512345678\",\n \"billingEmail\": \"john.doe@example.com\",\n \"billingAddressLine1\": \"123 Main St\",\n \"billingAddressLine2\": \"Apt 4B\",\n \"billingCity\": \"Mexico City\",\n \"billingState\": \"CDMX\",\n \"billingPostalCode\": \"12345\",\n \"billingCountry\": \"MX\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.cheqpay.mx/pos/payment-methods/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["x-merchant-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"billingFirstName\": \"John\",\n \"billingLastName\": \"Doe\",\n \"billingPhoneNumber\": \"+525512345678\",\n \"billingEmail\": \"john.doe@example.com\",\n \"billingAddressLine1\": \"123 Main St\",\n \"billingAddressLine2\": \"Apt 4B\",\n \"billingCity\": \"Mexico City\",\n \"billingState\": \"CDMX\",\n \"billingPostalCode\": \"12345\",\n \"billingCountry\": \"MX\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "CARD",
"isDefault": false,
"createdAt": "2025-01-15T10:00:00.000Z",
"updatedAt": "2025-01-15T10:00:00.000Z",
"nickname": "My Visa Card",
"billingFirstName": "John",
"billingLastName": "Doe",
"billingPhoneNumber": "+525512345678",
"billingEmail": "john.doe@example.com",
"billingAddressLine1": "123 Main St",
"billingAddressLine2": "Apt 4B",
"billingCity": "Mexico City",
"billingState": "CDMX",
"billingPostalCode": "12345",
"billingCountry": "MX",
"cardDetails": {
"last4": "1111",
"bin": "411111",
"expMonth": 12,
"expYear": 25,
"type": "credit",
"brand": "VISA",
"country": "US",
"issuerBank": "Chase Bank"
}
}{
"message": "Validation failed",
"errors": [
{
"field": "name",
"message": "Required"
}
]
}{
"message": "Invalid api key"
}{
"message": "Merchant not found"
}{
"message": "Error message"
}Update a payment method
Updates billing information for an existing payment method. At least one billing field must be provided. Card details cannot be updated.
curl --request PUT \
--url https://api.sandbox.cheqpay.mx/pos/payment-methods/{id} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-merchant-id: <api-key>' \
--data '
{
"billingFirstName": "John",
"billingLastName": "Doe",
"billingPhoneNumber": "+525512345678",
"billingEmail": "john.doe@example.com",
"billingAddressLine1": "123 Main St",
"billingAddressLine2": "Apt 4B",
"billingCity": "Mexico City",
"billingState": "CDMX",
"billingPostalCode": "12345",
"billingCountry": "MX"
}
'import requests
url = "https://api.sandbox.cheqpay.mx/pos/payment-methods/{id}"
payload = {
"billingFirstName": "John",
"billingLastName": "Doe",
"billingPhoneNumber": "+525512345678",
"billingEmail": "john.doe@example.com",
"billingAddressLine1": "123 Main St",
"billingAddressLine2": "Apt 4B",
"billingCity": "Mexico City",
"billingState": "CDMX",
"billingPostalCode": "12345",
"billingCountry": "MX"
}
headers = {
"x-api-key": "<api-key>",
"x-merchant-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-api-key': '<api-key>',
'x-merchant-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
billingFirstName: 'John',
billingLastName: 'Doe',
billingPhoneNumber: '+525512345678',
billingEmail: 'john.doe@example.com',
billingAddressLine1: '123 Main St',
billingAddressLine2: 'Apt 4B',
billingCity: 'Mexico City',
billingState: 'CDMX',
billingPostalCode: '12345',
billingCountry: 'MX'
})
};
fetch('https://api.sandbox.cheqpay.mx/pos/payment-methods/{id}', 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.sandbox.cheqpay.mx/pos/payment-methods/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'billingFirstName' => 'John',
'billingLastName' => 'Doe',
'billingPhoneNumber' => '+525512345678',
'billingEmail' => 'john.doe@example.com',
'billingAddressLine1' => '123 Main St',
'billingAddressLine2' => 'Apt 4B',
'billingCity' => 'Mexico City',
'billingState' => 'CDMX',
'billingPostalCode' => '12345',
'billingCountry' => 'MX'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-merchant-id: <api-key>"
],
]);
$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.sandbox.cheqpay.mx/pos/payment-methods/{id}"
payload := strings.NewReader("{\n \"billingFirstName\": \"John\",\n \"billingLastName\": \"Doe\",\n \"billingPhoneNumber\": \"+525512345678\",\n \"billingEmail\": \"john.doe@example.com\",\n \"billingAddressLine1\": \"123 Main St\",\n \"billingAddressLine2\": \"Apt 4B\",\n \"billingCity\": \"Mexico City\",\n \"billingState\": \"CDMX\",\n \"billingPostalCode\": \"12345\",\n \"billingCountry\": \"MX\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-merchant-id", "<api-key>")
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.put("https://api.sandbox.cheqpay.mx/pos/payment-methods/{id}")
.header("x-api-key", "<api-key>")
.header("x-merchant-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"billingFirstName\": \"John\",\n \"billingLastName\": \"Doe\",\n \"billingPhoneNumber\": \"+525512345678\",\n \"billingEmail\": \"john.doe@example.com\",\n \"billingAddressLine1\": \"123 Main St\",\n \"billingAddressLine2\": \"Apt 4B\",\n \"billingCity\": \"Mexico City\",\n \"billingState\": \"CDMX\",\n \"billingPostalCode\": \"12345\",\n \"billingCountry\": \"MX\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.cheqpay.mx/pos/payment-methods/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["x-merchant-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"billingFirstName\": \"John\",\n \"billingLastName\": \"Doe\",\n \"billingPhoneNumber\": \"+525512345678\",\n \"billingEmail\": \"john.doe@example.com\",\n \"billingAddressLine1\": \"123 Main St\",\n \"billingAddressLine2\": \"Apt 4B\",\n \"billingCity\": \"Mexico City\",\n \"billingState\": \"CDMX\",\n \"billingPostalCode\": \"12345\",\n \"billingCountry\": \"MX\"\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "CARD",
"isDefault": false,
"createdAt": "2025-01-15T10:00:00.000Z",
"updatedAt": "2025-01-15T10:00:00.000Z",
"nickname": "My Visa Card",
"billingFirstName": "John",
"billingLastName": "Doe",
"billingPhoneNumber": "+525512345678",
"billingEmail": "john.doe@example.com",
"billingAddressLine1": "123 Main St",
"billingAddressLine2": "Apt 4B",
"billingCity": "Mexico City",
"billingState": "CDMX",
"billingPostalCode": "12345",
"billingCountry": "MX",
"cardDetails": {
"last4": "1111",
"bin": "411111",
"expMonth": 12,
"expYear": 25,
"type": "credit",
"brand": "VISA",
"country": "US",
"issuerBank": "Chase Bank"
}
}{
"message": "Validation failed",
"errors": [
{
"field": "name",
"message": "Required"
}
]
}{
"message": "Invalid api key"
}{
"message": "Merchant not found"
}{
"message": "Error message"
}Authorizations
API key for authentication (required)
Merchant ID for identifying the merchant (required)
Path Parameters
Payment method ID
"123e4567-e89b-12d3-a456-426614174000"
Body
At least one billing field must be provided for update
Billing first name
"John"
Billing last name
"Doe"
Billing phone number
"+525512345678"
Billing email address
"john.doe@example.com"
Billing address line 1
"123 Main St"
Billing address line 2
"Apt 4B"
Billing city
"Mexico City"
Billing state
"CDMX"
Billing postal code
"12345"
Billing country code (2 characters)
2"MX"
Response
Payment method updated successfully
Payment method ID
"123e4567-e89b-12d3-a456-426614174000"
Payment method type
"CARD"
Whether this is the default payment method
false
Creation timestamp
"2025-01-15T10:00:00.000Z"
Last update timestamp
"2025-01-15T10:00:00.000Z"
Payment method nickname
"My Visa Card"
Billing first name
"John"
Billing last name
"Doe"
Billing phone number
"+525512345678"
Billing email address
"john.doe@example.com"
Billing address line 1
"123 Main St"
Billing address line 2
"Apt 4B"
Billing city
"Mexico City"
Billing state
"CDMX"
Billing postal code
"12345"
Billing country code
"MX"
Show child attributes
Show child attributes