papal加malformed_request JSON与送货地址

时间:2016-07-18 17:36:41

标签: json curl paypal

要显示Paypal和iFrame(REST API),我使用JSON发出请求

{
    “意图”:“销售”,
    “experience_profile_id”:“XP-XXXX-XXXX-XXX-XXX”,
    “redirect_urls”:{
        “return_url”:“https://www.XXXXXXX.de/bestellen.php”,
        “cancel_url”:“https://www.XXXXXXX.de/zahlungabbruch.php
    },

"payer": {  
    "payment_method": "paypal"  
},  
"transactions": [{  
    "amount": {  
        "total": "53.45",  
        "currency": "EUR",  
        "details": {  
            "subtotal": "49.5",  
            "shipping": "3.95"  
        }  
    },  
    "description": "Tollewolle",  
    "invoice_number": "",  
    "item_list": {  
        "items": [  

            {  
                "quantity": "4",  
                "name": "Fine Kid - 50",  
                "price": "8.25",  
                "currency": "EUR",  
                "sku": "8-50"  
            },  

            {  
                "quantity": "2",  
                "name": "Fine Kid - 208",  
                "price": "8.25",  
                "currency": "EUR",  
                "sku": "8-208"  
            }  

        ]  
    },  
    "shipping_address": {  
        "line1": "Rechnungs Str. 41",  
        "city": "Flensburg",  
        "postal_code": "24939",  
        "country_code": "DE"  
    }  
}]  

}

没有shipping_address它可以正常工作。 使用地址我得到错误'MALFORMED_REQUEST'

1 个答案:

答案 0 :(得分:0)

我认为送货地址是一个儿童ob lineitems所以你需要将它移动到一个水平。 E.g。

  

"交易":[{"金额":{"总计":" 53.45","货币&#34 ;:   " EUR","详情":{"小计":" 49.5","运费":   " 3.95"}},"说明":" Tollewolle"," invoice_number":"",   " item_list":{" items":[{" quantity":" 4"," name":&## 34;好孩子 - 50",   "价格":" 8.25","货币":" EUR"," sku":" 8-50"},{"数量":" 2",   "名称":"好孩子 - 208","价格":" 8.25","货币":& #34; EUR"," sku":   " 8-208"}]," shipping_address":{" line1":" Rechnungs Str。 41""城市&#34 ;:   "弗伦斯堡"," postal_code":" 24939"," country_code":" DE"}}}}