API Docs and Change History
Default Implementation
By default, the SDK can handle capturing payment methods with no intervention. Just make the following call at SDK initialization time:
VNPayment.configurePaymentProcessing(BraintreePaymentProcessableFragment())
That’s it!
Custom Implementation
If you would like to handle capturing of payment methods yourself, please use the following guide:
-
Create a Fragment that is an instance of
PaymentProcessableFragment
- to do this you’d need to conform the fragment to thePaymentProcessable
interface. -
The SDK will call
processPayment(paymentSelectionResultListener: PaymentSelectionResultListener)
in your fragment. This is the SDK telling you it needs you to provide it a payment method. You’ll likely need to store thePaymentSelectionResultListener
that was passed as a parameter so you can use it later to pass the data to the SDK. When this method is called - the SDK doesn’t care how you handle capturing or selecting a payment method. You can launch your UI here, do your payment method capturing, etc. -
When you’ve completed capturing/selecting of the payment method, you call
onPaymentResult(paymentResult: PaymentResult)
on thePaymentSelectionResultListener
that was passed to you inprocessPayment(paymentSelectionResultListener: PaymentSelectionResultListener)
.PaymentResult
is an interface that you’ll need to conform your object to in order to pass it back to the SDK in that method. That’s the end point of your integration - once the SDK receives thePaymentResult
, it takes over again. -
If capturing the payment method is unsuccessful or the user closes the selection screen before its completed, you just need to call
paymentSelectionResultListener.onCancel()
from thePaymentSelectionResultListener
the SDK passed to you inprocessPayment(paymentSelectionResultListener: PaymentSelectionResultListener)
. -
Once that fragment has been created, you just need to pass it to the SDK at initialization time:
VNPayment.configurePaymentProcessing(YourFragment())