Create Group Payment
Create a payment from multiple payment sources.
Each payment in the group payment must be from a different payment method.
This method triggers the Payment Succeeded Webhook for each payment method. This webhook contains the same information as the Create Group Payment response for the relevant payment method.
If all payments use a card payment method with capture
set to true, the following additional webhooks are sent:
Payment Completed - For a payment method that does not require 3DS authentication, this webhook is sent together with the response. For a payment method that requires 3DS authentication, this webhook is sent following 3DS authentication.
Group Payment Completed - If 3DS authentication is not required for any of the payment methods, this webhook is sent together with the response. Otherwise, it is sent when 3DS authentication is complete.
The following webhooks provide information about later changes to the group payment:
Asynchronous webhooks relating to each individual payment.
Note
Clients who have PCI clearance can use this method to collect money from a card.
Before you create a payment with the token for a payment method, verify that the value of
is_tokenizable
is true. See the response to List Payment Methods by Country.A card payment that requires 3DS authentication must be authenticated within 15 minutes.
To simulate completion of a card payment that requires 3DS authentication, see Simulating 3DS Authentication.
description
Description of the group payment transaction.
payments
Array of 'payment' objects. For details about the fields in the 'payment' object, see Create Payment.
Code Samples
.NET
using System; using System.Text.Json; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string payment = "gp_7e2b7abee522ba5089eb98c7482991ea"; string result = RapydApiRequestSample.Utilities.MakeRequest("DELETE", $"/v1/payments/group_payments/{payment}"); 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 body = { metadata: { merchant_defined: true }, merchant_reference_id: '12345689', payments: [ { payment_method: { type: 'us_discover_card', fields: { number: '4111111111111111', expiration_month: '11', expiration_year: '21', cvv: '123', name: 'Jane Doe', address: '123 Main Street, Anytown' }, metadata: null }, amount: 50, currency: 'USD', ewallets: [ { ewallet: 'ewallet_89099803a1e923a3e1fe9fc8f656b425' } ] }, { payment_method: { type: 'us_mastercard_card', fields: { number: '4111111111111111', expiration_month: '11', expiration_year: '21', cvv: '123', name: 'John Doe', address: '123 Main Street, Anytown' }, metadata: null }, amount: 200, currency: 'USD', ewallets: [ { ewallet: 'ewallet_89099803a1e923a3e1fe9fc8f656b425' } ] } ] }; const result = await makeRequest('POST', '/v1/payments/group_payments', body); 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 { $body = [ "merchant_reference_id" => "12345689", "payments" => [ array( "payment_method" => array( "type" => "us_discover_card", "fields" => array( "number" => "4111111111111111", "expiration_month" => "11", "expiration_year" => "21", "cvv" => "123", "name" => "Jane Doe", "address" => "123 Main Street, Anytown" ), "metadata" => null ), "amount" => 50, "currency" => "USD", "ewallets" => [ array( "ewallet" => "ewallet_4f8009d08b7b41e5d3b356494101d83b" ) ] ), ] ]; $object = make_request('post', '/v1/payments/group_payments/gp_64abd30667647f83395945ddc24c70b3'); var_dump($object); } catch(Exception $e) { echo "Error => $e"; } ?>
Python
from pprint import pprint from utilities import make_request group_payment_body = { "metadata": { "user_defined": "silver" }, "merchant_reference_id": "12345689", "payments": [{ "amount": 50, "currency": "USD", "payment_method": { "type": "us_visa_card", "fields": { "number": "4111111111111111", "expiration_month": "11", "expiration_year": "21", "cvv": "123", "name": "John Doe", "address": "123 Main Street, Anytown, NY" } }, "ewallets": [{ "ewallet": "ewallet_452c8cd682f347b4abee9bbee04eac03" } ] }, { "amount": 200, "currency": "USD", "payment_method": { "type": "us_visa_card", "fields": { "number": "4111111111111111", "expiration_month": "11", "expiration_year": "21", "cvv": "123", "name": "John Doe", "address": "123 Main Street, Anytown, NY" } }, "ewallets": [{ "ewallet": "ewallet_7424264d34c77c8b1096bac6afd54482" } ] }] } response = make_request(method='post', path='/v1/payments/group_payments', body=group_payment_body) pprint(response)
/v1/payments/group_payments
Create Group Payment
curl -X post https://sandboxapi.rapyd.net/v1/payments/group_payments -H 'access_key: your-access-key-here' -H 'Content-Type: application/json' -H 'idempotency: your-idempotency-parameter-here' -H 'salt: your-random-string-here' -H 'signature: your-calculated-signature-here' -H 'timestamp: your-unix-timestamp-here' -d '{ "metadata": { "merchant_defined": true }, "merchant_reference_id": "12345-69089", "payments": [ { "payment_method": { "type": "us_visa_card", "fields": { "number": "4111111111111111", "expiration_month": "11", "expiration_year": "25", "cvv": "123", "name": "John Doe" } }, "amount": 1025, "currency": "USD", "capture": true }, { "payment_method": { "type": "us_visa_card", "fields": { "number": "4462030000000000", "expiration_month": "11", "expiration_year": "25", "cvv": "789", "name": "Joe Doe" } }, "amount": 25, "currency": "USD", "capture": true } ] } '
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "fc5c48c4-b5c7-4d2e-9991-9abc53c96264" }, "data": { "id": "gp_89aedef8594241094a94685dcde3707b", "amount": 1050, "amount_to_replace": 0, "status": "active", "currency": "USD", "country": "US", "merchant_reference_id": "12345-69089", "description": "", "metadata": { "merchant_defined": true }, "expiration": null, "cancel_reason": null, "payments": [ { "id": "payment_9aa5c53b69114517b1e20ce4ba9eedd3", "amount": 25, "original_amount": 25, "is_partial": false, "currency_code": "USD", "country_code": "US", "status": "CLO", "description": "", "merchant_reference_id": "", "customer_token": "cus_4a5e278ce40d99a8f4cd9275593c675b", "payment_method": "card_263e6ea7d8742ace8f57bb57caed7e9c", "payment_method_data": { "id": "card_263e6ea7d8742ace8f57bb57caed7e9c", "type": "us_visa_card", "category": "card", "metadata": null, "image": "", "webhook_url": "", "supporting_documentation": "", "next_action": "not_applicable", "name": "Joe Doe", "last4": "0000", "acs_check": "unchecked", "cvv_check": "unchecked", "bin_details": { "type": null, "brand": null, "country": null, "bin_number": "446203" }, "expiration_year": "25", "expiration_month": "11", "fingerprint_token": "ocfp_1476e28831f830fb85356e3b61a1ed84" }, "expiration": 1641819397, "captured": true, "refunded": false, "refunded_amount": 0, "receipt_email": "", "redirect_url": "", "complete_payment_url": "", "error_payment_url": "", "receipt_number": "", "flow_type": "", "address": null, "statement_descriptor": "Rapyd", "transaction_id": "", "created_at": 1641214597, "metadata": {}, "failure_code": "", "failure_message": "", "paid": true, "paid_at": 1641214597, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": [], "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "ewallets": [ { "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "amount": 25, "percent": 100, "refunded_amount": 0 } ], "payment_method_options": {}, "payment_method_type": "us_visa_card", "payment_method_type_category": "card", "fx_rate": 1, "merchant_requested_currency": null, "merchant_requested_amount": null, "fixed_side": "", "payment_fees": null, "invoice": "", "escrow": null, "group_payment": "gp_89aedef8594241094a94685dcde3707b", "cancel_reason": null, "initiation_type": "customer_present", "mid": "", "next_action": "not_applicable", "error_code": "", "remitter_information": {} }, { "id": "payment_8775855f7a472b3a07c5894d2badb532", "amount": 0, "original_amount": 1025, "is_partial": false, "currency_code": "USD", "country_code": "US", "status": "ACT", "description": "", "merchant_reference_id": "", "customer_token": "cus_f6c0c6f52ce70ab15d7c3aee921f6e7d", "payment_method": "card_57fd1cc634d1ee5c0425e1e8afd3b5ce", "payment_method_data": { "id": "card_57fd1cc634d1ee5c0425e1e8afd3b5ce", "type": "us_visa_card", "category": "card", "metadata": null, "image": "", "webhook_url": "", "supporting_documentation": "", "next_action": "3d_verification", "name": "Jon Doe", "last4": "1111", "acs_check": "unchecked", "cvv_check": "unchecked", "bin_details": { "type": null, "brand": null, "country": null, "bin_number": "411111" }, "expiration_year": "25", "expiration_month": "11", "fingerprint_token": "ocfp_e599f990674473ce6283b245e9ad2467" }, "expiration": 1641819397, "captured": true, "refunded": false, "refunded_amount": 0, "receipt_email": "", "redirect_url": "https://sandboxcheckout.rapyd.net/3ds-payment?token=payment_8775855f7a472b3a07c5894d2badb532", "complete_payment_url": "", "error_payment_url": "", "receipt_number": "", "flow_type": "", "address": null, "statement_descriptor": "Rapyd", "transaction_id": "", "created_at": 1641214597, "metadata": {}, "failure_code": "", "failure_message": "", "paid": false, "paid_at": 0, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": [], "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "ewallets": [ { "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "amount": 1025, "percent": 100, "refunded_amount": 0 } ], "payment_method_options": {}, "payment_method_type": "us_visa_card", "payment_method_type_category": "card", "fx_rate": 1, "merchant_requested_currency": null, "merchant_requested_amount": null, "fixed_side": "", "payment_fees": null, "invoice": "", "escrow": null, "group_payment": "gp_89aedef8594241094a94685dcde3707b", "cancel_reason": null, "initiation_type": "customer_present", "mid": "", "next_action": "3d_verification", "error_code": "", "remitter_information": {} } ] } }