Discussions
Trying to create a source in live server but its always getting 500 error but when i tried in local host it is working
over 2 years ago by Joshua Marcius Rodillas
request('POST', 'https://api.paymongo.com/v1/sources', [
'body' => '{"data":{"attributes":{"amount":10000,"redirect":{"success":"http://localhost:3000/success.php","failed":"http://localhost:3000/failed.php"},"type":"gcash","currency":"PHP"}}}',
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Basic ************',
'Content-Type' => 'application/json',
],
]);
$data = json_decode($response->getBody(), true);
$redirect = $data['data']['attributes']['redirect']['checkout_url'];
header('Refresh: 3;URL='. $redirect);