0
I have a question about how to treat --data-binary
, the header
I know I can handle it that way:
$data = [
'USER' => $this->username,
'PWD' => $this->password,
'SIGNATURE' => $this->signature,
'METHOD' => 'SetExpressCheckout',
'VERSION' => 86,
];
Now the --data-binary
below, I don’t know how to assign.
curl
--data-binary
{
"MerchantOrderId":"2014113245231706",
"Customer":{
"Name":"Comprador rec programada"
},
"Payment":{
"Type":"CreditCard",
"Amount":1500,
"Installments":1,
"SoftDescriptor":"123456789ABCD",
"RecurrentPayment":{
"AuthorizeNow":"false",
"EndDate":"2019-12-01",
"Interval":"SemiAnnual",
"StartDate":"2015-06-01"
},
"CreditCard":{
"CardNumber":"1234123412341231",
"Holder":"Teste Holder",
"ExpirationDate":"03/2019",
"SecurityCode":"262",
"SaveCard":"false",
"Brand":"Visa"
}
}
}
Can someone give me a hand?
Can you be clearer in your question? What do you need to do? How did you try to do it? What mistakes did you make? Add that to the question to make it easier for us to understand.
– Woss
Make a
CURLOPT_POSTFIELDS
with the data ofjson
guy,curl_setopt(CURLOPT_POSTFIELDS, $json)
. Maybe that’s enough, but I’m not sure.– Inkeliz
my question is exactly how to put the data-Binary inside the JSON: I don’t know how to treat the Custumer, payment and Credit Card divisions ː "Merchantorderid":"2014113245231706", "Customer":+ "Name":"Buyer rec programmed" },
– Felipe Lima Diniz
It is not clear your doubt, the
--data-binary
only indicates that what comes next is the information to be sent, it does not have to be placed inside the JSON, this makes no sense. For examplecurl -d "parametro=valor&outro=coisa"
the-d
indicates that it will be ax-www-form-urlencoded
with the values ("parameter=value&other=thing"), if it is-f
must make amultipart/form-data
... The--data-binary
indicates, to the best of my knowledge, that it should be sent "as is" without any treatment by CURL. Already the creation of the JSON is something else, which should be documented in the API.– Inkeliz
My question is this, how to document the JSON in the API ? Can you help me, please?
– Felipe Lima Diniz