Delete Payment Method
Delete a payment method from a customer profile.
This method triggers the Payment Method Canceled Webhook. This webhook contains more information than the response.
customer
ID of the
customer. String starting with cus_.
payment_method
ID of the payment method to delete. String starting with card_ or other_.
deleted
Indicates whether the payment method was deleted.
id
ID of the payment method.
Code Samples
.NET
using System; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string customerId = "cus_217f61d6757465a9716666ccf4d3ec73"; string paymentMethod = "other_5d3555aa69ffd545ef56c5212cf0d3d1"; string result = RapydApiRequestSample.Utilities.MakeRequest("DELETE", $"/v1/customers/{customerId}/payment_methods/{paymentMethod}"); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Error completing request: " + e.Message); } } } }
JavaScript
const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest; async function main() { try { const result = await makeRequest( 'DELETE', '/v1/customers/cus_217f61d6757465a9716666ccf4d3ec73/payment_methods/other_5d3555aa69ffd545ef56c5212cf0d3d1' ); console.log(result); } catch (error) { console.error('Error completing request', error); } }
PHP
<?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/<path-to-your-utility-file>/utilities.php"; include($path); try { $object = make_request('delete', "/v1/customers/cus_217f61d6757465a9716666ccf4d3ec73/other_5d3555aa69ffd545ef56c5212cf0d3d1"); var_dump($object); } catch (Exception $e) { echo "Error: $e"; } ?>
Python
from pprint import pprint from utilities import make_request result = make_request(method='delete', path='/v1/customers/cus_217f61d6757465a9716666ccf4d3ec73/payment_methods/other_5d3555aa69ffd545ef56c5212cf0d3d1') pprint(result)
/v1/customers/:customer/payment_methods/:payment_method
Cash
curl -X delete 'https://sandboxapi.rapyd.net/v1/customers/cus_9f4965b9807bc1aeae67b47a0ae5b081/payment_methods/other_f2900c94ad3aae801d36dd2dfee5280a' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here'
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "b9dddc6e-068e-4c12-9c0c-b3981ba6bb04" }, "data": { "deleted": true, "id": "other_f2900c94ad3aae801d36dd2dfee5280a" } }
Bank transfer
curl -X delete 'https://sandboxapi.rapyd.net/v1/customers/cus_9f4965b9807bc1aeae67b47a0ae5b081/payment_methods/other_b413d06bab57cb61b07232004ae1e0e4' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here'
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "96f9a0b7-6b92-472a-ae91-5cb03f2daa1c" }, "data": { "deleted": true, "id": "other_b413d06bab57cb61b07232004ae1e0e4" } }
Bank redirect
curl -X delete 'https://sandboxapi.rapyd.net/v1/customers/cus_4e25112ac20e144ad073a614dc46934b/payment_methods/other_22f72fe40cb170622bc4e3c641db43eb' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here'
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "a9e02a46-5b94-471c-991a-ea59d7da74fc" }, "data": { "deleted": true, "id": "other_22f72fe40cb170622bc4e3c641db43eb" } }
Card
curl -X delete 'https://sandboxapi.rapyd.net/v1/customers/cus_9f4965b9807bc1aeae67b47a0ae5b081/payment_methods/card_d5cf1a06c0e99b5570acef624e8d984e' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here'
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "c3cb259a-4ee5-43cd-9f6d-9c7a69fd4783" }, "data": { "deleted": true, "id": "card_dfb616c07f24fde89fbcf47e4f4335f1" } }