I assume you're running this from a script or command-line.
-H
refers to a Header option and
-d
refers to the data portion of the command.
I translated the JSON String you have into a PHP Associative Array to transform back into JSON String (safety!).
PHP Code:
$data = array(
"intent" => "sale",
"redirect_urls" => array(
"return_url" => "http://example.com/your_redirect_url/",
"cancel_url" => "http://example.com/your_cancel_url/"
),
"payer": array(
"payment_method" => "paypal"
),
"transactions" => array(
array(
"amount" => array({
"total" => "7.47",
"currency" => "USD"
)
)
)
);
$data_string = json_encode($data);
$ch = curl_init( "https://api.sandbox.paypal.com/v1/payments/payment" );
curl_setopt_array( $ch, array(
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string)),
'Authorization: Bearer ' . $accessToken //Need to set $accessToken
),
CURLOPT_POSTFIELDS => $data_string,
CURLOPT_RETURNTRANSFER => true
));
$result = curl_exec( $ch ); //Make it all happen and store response