iosswiftpaypalp2p

Peer To Peer Transaction Through Paypal - iOS


I am trying to implement peer to peer transaction through PayPal. I am currently adding a feature where user can sell the goods from his account through my app to another user. For that the buyer has to pay online through PayPal to seller.

Scenario:

User A displays the item for sale. User B bids on it. User A accepts the bid. Now User B has to pay the said amount through PayPal so that User A can send his item to User B. Both users are normal users, they are not premium or business. The idea is to send money from B -> A in a decentralized way so that my server just know either the transaction is successful or not.

Questions:

  1. Is there any way to make this payment peer to peer through PayPal? So that, app side and the server side just receives the acknowledgement of this transaction.
  2. If it is possible then how can we notify the server that the transaction has been made?

Thanks in advance!


Solution

  • Using PayPal Checkout, be it with the web JS SDK, native SDK for iOS/Android, or v2/checkout/orders REST API alone, payments can be directed to a different destination account by including a payee object in the purchase_units of the request.

    Example

        {
          intent: 'CAPTURE',
          purchase_units: [{
            amount: {
              currency_code: 'USD',
              value: '220.00'
            },
            payee: {
              email_address: 'receiveraccount@emaildomain.com'
            }
          }]
        }
    

    After payer approval, capture the order. The contents of the capture response object purchase_units[0].payments.captures[0] will contain the PayPal transaction ID and indicate success or failure.