首页 > 解决方案 > Paypal REST API - 检测到重复的发票 ID

问题描述

即使我为每个交易请求使用唯一的 invoice_number,我也收到此错误。但我不明白为什么它报告重复。

{"name":"DUPLICATE_TRANSACTION","details":[],"message":"检测到重复的发票 ID。","information_link":" https://developer.paypal.com/docs/api/payments/#错误","debug_id":"8c24c538da594"}

查看异常:- 在此处输入图像描述

这里是构建 PAYPAL REST API 的代码:-

 var data_custom = new EzyWrap.Web.UI.Models.TransactionCustom
        {
            OrderId = orderId,
            StoreName = SiteSetting.Store.Name,
            Name = FirstName + LastName
        };            

   // Adding description about the transaction
        transactionList.Add(new Transaction()
        {
            description = SiteSetting.Store.Name, //The store name 
            invoice_number = orderId, //Order Id that unique each paypal request
            amount = amount, //Cart Amount
            item_list = new ItemList()
            {
                items = itemList.items, //List of Cart Item
                shipping_address = shippingInfo //Shipping Information For Adddress
            },
            notify_url = notigyUrl,//Notify Url for IPN response
            custom = JsonConvert.SerializeObject(data_custom),//Pass custom data of client information in json format
            reference_id = cart.FirstOrDefault().ReferenceNumber//Pass Reference Id Of the cart
        });

   this.payment = new Payment()
        {
            intent = "sale",
            payer = payer,
            transactions = transactionList,
            redirect_urls = redirUrls,
        };

        // Create a payment using a APIContext
        return this.payment.Create(apiContext);

每次paypal因为重复发票而拒绝它。任何想法如何解决这一问题?

标签: paypalpaypal-sandboxpaypal-rest-sdk

解决方案


推荐阅读