duanhuo3392 2019-03-19 09:58
浏览 97

PayPal TRANSACTION_REFUSED退款错误转到SDK

I am working on integraing PayPal for payment and using its Go SDK. I have saved a card into vault and from that card id I am trying to refund a payment. following is the response of the payment done through credit card:

{
    "intent": "sale",
    "payer": {
        "payment_method": "credit_card",
        "funding_instruments": [
            {
                "credit_card_token": {
                    "credit_card_id": "CARD-ID",
                    "last4": "9669",
                    "expire_year": "2021",
                    "expire_month": "6"
                }
            }
        ]
    },
    "transactions": [
        {
            "amount": {
                "currency": "USD",
                "total": "10.00",
                "details": {
                    "subtotal": "10.00"
                }
            },
            "description": "test description",
            "related_resources": [
                {
                    "sale": {
                        "id": "SALE-ID",
                        "amount": {
                            "currency": "USD",
                            "total": "10.00",
                            "details": {}
                        },
                        "create_time": "2019-03-19T09:31:01Z",
                        "state": "pending",
                        "parent_payment": "PAY-ID",
                        "update_time": "2019-03-19T09:31:06Z",
                        "links": [
                            {
                                "href": "https://api.sandbox.paypal.com/v1/payments/sale/SALE-ID",
                                "rel": "self",
                                "method": "GET"
                            },
                            {
                                "href": "https://api.sandbox.paypal.com/v1/payments/sale/SALE-ID/refund",
                                "rel": "refund",
                                "method": "POST"
                            },
                            {
                                "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-ID",
                                "rel": "parent_payment",
                                "method": "GET"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "id": "PAY-ID",
    "create_time": "2019-03-19T09:31:01Z",
    "state": "approved",
    "update_time": "2019-03-19T09:31:06Z",
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-ID",
            "rel": "self",
            "method": "GET"
        }
    ]
}

Now below code is to process the refund:

amount := paypalsdk.Amount{
   Currency: "USD",
   Total: "5.00",
}
refundResp, err = client.RefundSale(saleId, &amount)

This returns the following response:

 {
        "name": "TRANSACTION_REFUSED",
        "debug_id": "ca89e0e86326",
        "message": "Request was refused.You can not do a partial refund on this transaction",
        "information_link": "https://developer.paypal.com/docs/api/payments/#errors",
        "details": null
    }

In my account settings I have payment review set to OFF. Does anyone know what I might be doing wrong?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)