There are a few ways to associate a PayPal account with a buyer.

Associate by buyer_id

The easiest way to associate a buyer with a PayPal account is to pass along a buyer_id when creating a PayPal account.

This will find a buyer with that id and associate the PayPal account with it. If a buyer with that id could not be found it’s ignored.

curl -i -X POST "https://api.example.gr4vy.app/payment-methods" \
    -H "Authorization: Bearer [JWT_TOKEN]" \
    -H "Content-Type: application/json" \
    -d '{
        "method": "paypal",
        "redirect_url": "https://example.com/callback",
        "buyer_id": "fe26475d-ec3e-4884-9553-f7356683f7f9"
      }'

Associate by buyer_external_identifier

Alternatively, a PayPal account can be associated with a buyer by using it’s external_identifier. If a buyer with that external_identifier could not be found it’s ignored.

curl -i -X POST "https://api.example.gr4vy.app/payment-methods" \
    -H "Authorization: Bearer [JWT_TOKEN]" \
    -H "Content-Type: application/json" \
    -d '{
        "method": "paypal",
        "redirect_url": "https://example.com/callback",
        "buyer_external_identifier": "412231123"
      }'