Android Business Payment APIs
Business payment APIs for sending payment requests via BLE and accessing payment history. Access these APIs through Vipaso.payment.business
.
Payment History
Fetch Payments
Retrieve a paginated list of payment transactions with optional filtering by status:
val payments: List<VipasoPayment> = Vipaso.payment.business.fetchPayments(
page = 0,
status = VipasoPaymentStatus.COMPLETED
)
Possible VipasoPaymentStatus
values:
INITIATED
: Payment has been created but processing hasn't startedIN_PROGRESS
: Payment is currently being processedCOMPLETED
: Payment has been successfully completed and funds transferredFAILED
: Payment processing failed due to an errorCANCELLED
: Payment was cancelled by the user, merchant, or system
Fetch Payment
Fetch the complete details of a specific payment by its ID:
val paymentDetails: VipasoPayment = Vipaso.payment.business.fetchPayment(paymentId = "payment_id")
Possible VipasoPaymentStatus
values:
INITIATED
: Payment has been created but processing hasn't startedIN_PROGRESS
: Payment is currently being processedCOMPLETED
: Payment has been successfully completed and funds transferredFAILED
: Payment processing failed due to an errorCANCELLED
: Payment was cancelled by the user, merchant, or system
BLE Payment (Send)
Send a payment request via BLE
Send a payment request to all potential payers in range via BLE. The method returns when the first payer successfully accepts the payment.
val result: VipasoPaymentResult = Vipaso.payment.business.sendPaymentRequestViaBle(
amount = "12.00",
currency = "USD",
paymentReference = null // or a custom reference string
)
Possible VipasoPaymentResult
outcomes:
-
PaymentSuccessful(paymentId: UUID, amount: String, tip: String, currency: String)
- The payment was approved by both Business and Customer.
- Example amounts:
"100.00"
for amount,"0.00"
for tip.
-
PaymentCancelled(paymentId: UUID)
- The payment was cancelled on the Business device.
-
PaymentFailed(paymentId: UUID, error: Throwable)
- There was an unrecoverable error on the Business side.
Cancel Payment
Cancel the current payment operation and terminate BLE.
Vipaso.payment.business.cancelPayment()
Stop BLE
Stop BLE without cancelling the current payment.
Vipaso.payment.business.stopBle()