如何获得状态="已完成" PayPal付款

时间:2014-08-19 09:33:25

标签: c# paypal

我在执行付款后收到了这个JSON,但状态仍然是"等待"我怎样才能解决这个问题才能获得"完成"。

我已经尝试了几件事来付款但没有成功

{
  "id": "PAY-2NU51454E4492922YKPZRNBA",
  "create_time": "2014-08-19T09:19:00Z",
  "update_time": "2014-08-19T09:19:32Z",
  "intent": "sale",
  "payer": {
    "payment_method": "paypal",
    "payer_info": {
      "email": "severiano.testes@gmail.com",
      "first_name": "Diogo",
      "last_name": "Severiano",
      "payer_id": "MSQ6UB55W52N6",
      "shipping_address": {
        "line1": "1 Main Terrace",
        "line2": "",
        "city": "Wolverhampton",
        "country_code": "GB",
        "postal_code": "W12 4LQ",
        "state": "West Midlands"
      }
    }
  },
  "transactions": [
    {
      "amount": {
        "currency": "EUR",
        "total": "54.00",
        "details": {
          "subtotal": "54.00"
        }
      },
      "description": "Transaction Description",
      "item_list": {
        "items": [
          {
            "quantity": "1",
            "name": "Project Submission (featured)",
            "price": "54.00",
            "currency": "EUR",
            "sku": "27365"
          }
        ],
        "shipping_address": {
          "recipient_name": "Diogo Severiano",
          "line1": "1 Main Terrace",
          "line2": "",
          "city": "Wolverhampton",
          "country_code": "GB",
          "postal_code": "W12 4LQ",
          "state": "West Midlands"
        }
      },
      "related_resources": [
        {
          "sale": {
            "id": "1BJ06026CY7370157",
            "create_time": "2014-08-19T09:19:00Z",
            "update_time": "2014-08-19T09:19:32Z",
            "amount": {
              "currency": "EUR",
              "total": "54.00"
            },
            "state": "pending",
            "parent_payment": "PAY-2NU51454E4492922YKPZRNBA",
            "links": [
              {
                "href": "https://api.sandbox.paypal.com/v1/payments/sale/1BJ06026CY7370157",
                "rel": "self",
                "method": "GET"
              },
              {
                "href": "https://api.sandbox.paypal.com/v1/payments/sale/1BJ06026CY7370157/refund",
                "rel": "refund",
                "method": "POST"
              },
              {
                "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-2NU51454E4492922YKPZRNBA",
                "rel": "parent_payment",
                "method": "GET"
              }
            ]
          }
        }
      ]
    }
  ],
  "state": "approved",
  "links": [
    {
      "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-2NU51454E4492922YKPZRNBA",
      "rel": "self",
      "method": "GET"
    }
  ]
} 

我使用C#来做到这一点:  使用它之后,结果就在上面。

var data = JsonConvert.DeserializeObject<Rootobject>(context.Session["RespostaJson"].ToString());                
                pymnt = new Payment();
                pymnt.id = data.id;
                PaymentExecution pymntExecution = new PaymentExecution();
                pymntExecution.payer_id = context.Request.Params["PayerID"];
                Payment executedPayment = pymnt.Execute(apiContext, pymntExecution);

                context.Response.Write(JObject.Parse(executedPayment.ConvertToJson()).ToString(Formatting.Indented));

1 个答案:

答案 0 :(得分:0)

The receiver account (info.severiano-facilitator@gmail.com) has the primary currency set     
to USD but your transaction currency is in the EUR . Whenever you receive the payment in 
the currency that your account doesn't hold , you need to manually accept the transaction 
by logging to the account . Once you accept the payment PayPal will prompt you to either :

1. Deny the payment 
2. Or accept in the new currency and open the balance in the new currency 
3. Or accept the payment and convert the payment into your primary currency .

For now I have accepted the EUR currency( second choice 2.) for your sandbox account .   
Now you should be fine with your next payment and you will receive the Payment status    
as "completed ".