我正在尝试使用 Paypal REST API 在发票上设置付款条款的日期。
它说的格式是这样的
Date on which invoice payment is due. It must be always a future date. Date format yyyy-MM-dd z, as defined in ISO8601.
我如何使用 PHP 创建这个日期,我已经尝试了很多变体,但我似乎无法让它工作。是“z”让我感到震惊。
非常感谢。
利亚姆
发送的数据
{
"number":"2",
"merchant_info":{
"email":"xxx@xxx.com",
"business_name":"xxx",
"phone":{
"country_code":34,
"national_number":"969696969"
},
"address":{
"line1":"xxx",
"city":"xxxx",
"state":"xxxx",
"postal_code":"xxxx",
"country_code":"ES"
}
},
"billing_info":[
{
"email":"xxxx@xxx.com",
"first_name":"xxx",
"address":{
"line1":"xxx",
"city":"xxx",
"state":"xxx",
"postal_code":"xxx ",
"country_code":"ES"
}
}
],
"shipping_info":{
"first_name":"xxx@xxx.com",
"address":{
"line1":"xxx xxx xxx",
"city":"xxx",
"state":"xxx",
"postal_code":"xxx ",
"country_code":"ES"
}
},
"items":[
{
"name":"www ",
"quantity":"1",
"description":"www",
"unit_price":{
"currency":"EUR",
"value":"11.66"
}
},
{
"name":"www",
"quantity":"1",
"description":"www",
"unit_price":{
"currency":"EUR",
"value":"4.67"
}
},
{
"name":"www",
"quantity":"1",
"description":"www",
"unit_price":{
"currency":"EUR",
"value":"3.11"
}
}
],
"note":"Payment is to made with 7 Days",
"payment_term":{
"due_date":"2015-02-10 z"
},
"merchant_preferences":{
"return_url":"http:\/\/google.co.uk",
"cancel_url":"http:\/\/google.co.uk"
}
}
收到的响应是错误 400。
{
"name":"VALIDATION_ERROR",
"message":"Invalid request - see details.",
"debug_id":"8344d1d69459e",
"details":[
{
"field":"payment_term",
"issue":"either term type or, due date is required."
},
{
"field":"payment_term.due_date",
"issue":"only date value with 'yyyy-MM-dd z' format is allowed."
}
]
}
为了便于阅读,EdSF 在下面正确地回答了这个问题
使用
date('Y-m-d e');
最佳答案
为了便于阅读,EdSF 正确回答了这个问题
使用
date('Y-m-d e');
关于 Paypal REST Api payment_term 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28427985/