Am trying to make payments to a wallets using Rapyd Collect in php following the 2 sample code below but it print null Value as result
https://docs.rapyd.net/build-with-rapyd/reference/payment-object
sample code 1;
<?php
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/payments/utilities.php";
include($path);
$body = [
'receipt_email' => 'johndow@rapyd.net',
"amount"=> 100,
"currency"=> "USD",
"description"=> "Payment by card token",
"payment_method"=> "card_823894ee89c52be00e76d2be10116672",
"complete_payment_url"=> "http://localhost/success.php",
"ewallets"=> [
"ewallet"=> "ewalletmy-ewallet-id-goes-here",
"percentage"=> 100
],
"address"=> [
"name"=> 'John Doe',
"line_1"=> '123 Main Street',
"line_2"=> 'Penthouse',
"line_3"=> '',
"city"=> 'Anytown',
"district"=> '',
"canton"=> '',
"state"=> 'NY',
"country"=> 'US',
"zip"=> '12345',
"phone_number"=> '16125551234'
]
];
try {
$object = make_request('post', '/v1/payments/payment_19e3edad1e9102cd24006a34c52c9a0b', $body);
var_dump($object);
} catch(Exception $e) {
echo "Error: $e";
}
exit();
?>
I think the problem is value for payment_19e3edad1e9102cd24006a34c52c9a0b or card_823894ee89c52be00e76d2be10116672.
What are they. how can I solve the issue
**sample code 2:**
This sample code 2 below also displays **null value** as result. It seems some parameters needed to be passed as objects or arrays. can someone hep me out
<?php
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/payments/utilities.php";
include($path);
$body = [
'receipt_email' => 'johndow@rapyd.net',
"amount"=> 100,
"currency"=> "USD",
"description"=> "Payment by card token",
"ewallets"=> [
"ewallet"=> "ewalletmy-ewallet-id-goes-here",
"percentage"=> 100
],
"metadata"=> [
"merchant_defined"=> true
],
"payment_method"=> [
"type"=> "is_visa_card",
"fields"=> [
"name"=> "Test User",
"number"=> "4111111111111111",
"expiration_month"=> "08",
"expiration_year"=> "24",
"cvv"=> "789"
],
"complete_payment_url"=> "http://localhost/success.php",
"error_payment_url"=> "http://localhost/error.php"
],
"address"=> [
"name"=> 'John Doe',
"line_1"=> '123 Main Street',
"line_2"=> 'Penthouse',
"line_3"=> '',
"city"=> 'Anytown',
"district"=> '',
"canton"=> '',
"state"=> 'NY',
"country"=> 'US',
"zip"=> '12345',
"phone_number"=> '16125551234'
]
];
try {
$object = make_request('post', '/v1/payments', $body);
var_dump($object);
} catch(Exception $e) {
echo "Error: $e";
}
?>