gpt4 book ai didi

python - 我无法在 Paypal 支付集成中预填手机号码

转载 作者:太空宇宙 更新时间:2023-11-03 15:49:57 26 4
gpt4 key购买 nike

payment = Payment({
"intent": "sale",

"application_context": {
"locale": "en_IN",
"user_action": "commit",
"shipping_preference": "NO_SHIPPING",
"landing_page": "billing"
},

# Set payment method
"payer": {
"payment_method": "paypal",
"payer_info": {
"email": email,
"first_name": first_name,
"last_name": last_name,
"shipping_address": {
"phone": phone,
}
}
},

# Set redirect URLs
"redirect_urls": {
"return_url": "example.com/confpayment/",
"cancel_url": "examplecom/payment_fail/"
},
# Set transaction object
"transactions": [{
"amount": {
"total": str(amount),
# "total": "1",
"currency": "INR"
},
"description": "payment description"
}]
})

我收到传入的 JSON 请求未映射到 API 请求

Error:{'name': 'MALFORMED_REQUEST', 'message': 'Incoming JSON request does not map to API request', 'information_link': 'https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST', 'debug_id': '51397a89429bd'}

除手机号码外,所有其他内容均已预填。请帮我解决这个问题。

我不确定API格式是否正确。

最佳答案

编辑预览代码错误:

payer 属性的文档在这里(链接更正为 V2):

https://developer.paypal.com/docs/api/orders/v2/?mark=payer#definition-payer

错误,删除多余的逗号:"phone": "",

"payer_info": {
...
"shipping_address": {
"phone": ""
}
}

这段代码似乎是错误的:

phone 移到 shipping_address 之外:

"payer_info": {
...
"shipping_address": {
...
},
"phone": ""
}

这里有完整的样本:http://www.seneca-re.com/wp-content/plugins/estatik/vendor/paypal/rest-api-sdk-php/sample/payments/ListPayments.php

关于python - 我无法在 Paypal 支付集成中预填手机号码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55218678/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com