PayPal支持用户间付款吗?新加坡类eBay iOS APP技术咨询
Hey there! Great question—this is totally achievable with PayPal, and I’ve supported several marketplace-style apps (like your eBay-like platform) in setting up exactly this kind of functionality.
Here’s how you can implement it:
1. Use PayPal’s Custom/Reference Fields in Payment Requests
PayPal provides built-in fields to attach your platform’s reference data when initiating a payment between users. The most practical options are:
custom: A free-text field (max 127 characters) where you can store your platform’s internal order ID, transaction reference, or any other metadata you need to link the payment to your system.invoice_id: A unique identifier (max 127 characters) tied to your platform’s order/invoice system—perfect for reconciling PayPal transactions with your internal records.note_to_payee: A short message (max 255 characters) that User B will see directly in their PayPal account, which can explicitly mention your platform and reference info (e.g., "Payment for Order #1234 on Your SG Marketplace").
2. Implementation in Your iOS App
For security, it’s best to handle payment initiation from your backend (not directly from the app) to protect your PayPal API credentials. But if you’re using the PayPal iOS SDK or integrating via REST API, here’s how you’d pass these fields:
Example REST API Request (Backend-Side)
{ "intent": "sale", "payer": { "payment_method": "paypal" }, "transactions": [ { "amount": { "total": "15.99", "currency": "SGD" }, "custom": "YOUR_PLATFORM_ORDER_78901", "invoice_id": "INV-23456", "note_to_payee": "Payment for order #78901 on Your Singapore Marketplace" } ] }
Example with PayPal iOS SDK
let payment = PayPalPayment(amount: NSDecimalNumber(string: "15.99"), currencyCode: "SGD", shortDescription: "Order #78901", intent: .sale) payment.custom = "YOUR_PLATFORM_ORDER_78901" payment.invoiceId = "INV-23456" payment.noteToPayee = "Payment for order #78901 on Your Singapore Marketplace"
3. Retrieving Reference Info Post-Payment
Once the payment is completed, you can pull these fields via PayPal’s webhooks (triggered when a payment is finalized) or by fetching transaction details using the PayPal API. This lets your platform automatically link the PayPal transaction to your internal order records for tracking and reconciliation.
Quick Tips
- Never expose your PayPal API credentials in the iOS app—always route payment requests through your backend.
- Keep
customandinvoice_idvalues unique per transaction to avoid mix-ups during reconciliation. - Double-check PayPal’s latest docs for any updates to field limits or requirements.
内容的提问来源于stack exchange,提问作者Ravi Raj

