I am trying to send a post request in laravel. Below is my code:
$response = Http::withToken($local_signature)
->post('myUrl', [
"amount" => $amount,
"narration" => $narration,
"currency" => $currency,
"beneficiary_name" => $beneficiary_name,
"reference" => $reference,
"debit_currency" => $debit_currency,
"callback_url" => $callback_url,
"meta" => array(
"account_number" => $account_number,
"routing_number" => $routing_number,
"swift_code" => $swift_code,
"bank_name" => $bank_name,
"beneficiary_name" => $beneficiary_name,
"beneficiary_address" => $beneficiary_address,
"beneficiary_country" => $beneficiary_country,
)
]);
For some reason meta is not seen by the server as I keep getting error “meta is required and it must be a non-empty array”. How do I send this post request with meta as an array?
I need the request to look like this:
{
"amount": 500,
"narration": "Sample USD Transfer",
"currency": "USD",
"beneficiary_name": "Mark Cuban",
"meta": [
{
"account_number": "09182972BH",
"routing_number": "0000000002993",
"swift_code": "ABJG190",
"bank_name": "BANK OF AMERICA, N.A., SAN FRANCISCO, CA",
"beneficiary_name": "Mark Cuban",
"beneficiary_address": "San Francisco, 4 Newton",
"beneficiary_country": "US"
}
]
}
Any help?