# Alipay+ API integration
User-presented Mode Payment
[Integration overview](https://docs.alipayplus.com/alipayplus/alipayplus/integration_user_mode_acq/integration?role=ACQP&product=Payment1&version=1.3.1)
[Accept a payment](https://docs.alipayplus.com/alipayplus/alipayplus/integration_user_mode_acq/accept_payment)
In the User-presented Mode Payment scenario, the **notifyPayment** and **inquiryPayment** APIs are both required to be integrated, thus working together to ensure the ACQP obtain the final payment result. Refer to the Collaboration between inquiryPayment and notifyPayment section to learn about how to handle the payment statuses that are obtained via these two APIs, as well as ensure the accuracy of the final payment result.
[Obtain payment results](https://docs.alipayplus.com/alipayplus/alipayplus/integration_user_mode_acq/obtain_payment_results)
After calling the pay API, the Acquiring Service Provider (ACQP) can get the payment result in the following three ways:
* Get the payment result from the synchronous response of the pay API.
* Get the payment result from the asynchronous payment notification sent by Alipay+ through the notifyPayment API.
* Call the inquiryPayment API to inquire about the payment result.
## Ogloba API - Redeem flow
```mermaid
sequenceDiagram
participant USER
participant MERCHANT
participant Ogloba API
participant Alipay
participant Ogloba DB
USER ->> MERCHANT: Show Alipay payment code
MERCHANT ->> MERCHANT: Scan the payment code
MERCHANT ->> Ogloba API: Redeem
note over MERCHANT: Send redemption request with payemnt code
Ogloba API ->> Ogloba DB: Create an order to generate a referenceNumber sent to Alipay
Ogloba API ->> Alipay: Initial a payment and send payment request
note over Ogloba API: Send the Ogloba referenceNumber as paymentRequestId in the Alipay request
note over Ogloba API: The paymentNotifyUrl must be specified in the request for callback purpose
Alipay ->> Alipay: Decode and obtain customerId
Alipay ->> USER: Initial payment with customerId
USER ->> USER: Complete payment
USER -->> Alipay: Return payment result
Alipay -->> Ogloba API: Return payment result
alt result.resultStatus = U
loop Alipay Inquiry
Ogloba API ->> Ogloba DB: Check Alipay payment status
Ogloba DB -->> Ogloba API: Return Alipay payment status
alt status = INIT
Ogloba API ->> Alipay: Inquiry payment result
Alipay -->> Ogloba API: Return payment result
alt paymentResult.status = S or F
Ogloba API ->> Ogloba DB: Update the payment status
end
end
end
end
alt Receive Alipay notify request
note over Alipay: Once the payment is processed, Alipay+ will send the payment result in a short, certain time period, for example, 10 seconds
Alipay ->> Ogloba API: Notify payment result (callback)
note over Alipay: Notify payment result by notifyPayment API
Ogloba API ->> Ogloba DB: Check Alipay payment status
Ogloba DB -->> Ogloba API: Return Alipay payment status
alt status = INIT
Ogloba API ->> Ogloba DB: Update the payment status
end
end
Ogloba API -->> MERCHANT: Return redeem result
alt Redeem success
MERCHANT ->> Ogloba API: Redeem confirm
Ogloba API ->> Ogloba DB: Call confirm SP
Ogloba DB -->> Ogloba API: Confirm result
Ogloba API -->> MERCHANT: Redeem confirm result
end
```
## Ogloba API - Void flow
[Cancel or refund a payment of Alipay+](https://docs.alipayplus.com/alipayplus/alipayplus/integration_user_mode_acq/cancel_or_refund)
After initiating a payment, the Acquiring Service Provider (ACQP) can cancel or refund a payment.
Cancellation: A payment can be cancelled within the agreed cancellable period, which is from the time the initial payment is made until 00:15 UTC+8 on T+1 day, regardless of the payment status. If a payment exceeds the cancellable period, you need to initiate a refund instead.
Refund: A payment can be refunded any time after the transaction is successfully paid and before the refund period expires. The refund expiration period is usually one calendar year, starting from when the initial payment is made.
[Cancel a payment](https://docs.alipayplus.com/alipayplus/alipayplus/integration_user_mode_acq/cancel_payment)
The Acquiring Service Provider(ACQP) can cancel the payment by using the cancelPayment API.
[Refund](https://docs.alipayplus.com/alipayplus/alipayplus/integration_user_mode_acq/refund)
The Acquiring Service Provider(ACQP) can refund a payment by using the refund API or the Alipay+ Partner Workspace. The refund service is only applicable to a transaction that has been successfully paid.
* **Refundable amount**: Alipay+ supports full refunds, partial refunds, and multiple partial refunds. For a single transaction, the total amount of multiple partial refunds cannot exceed the original amount paid by the user.
```mermaid
sequenceDiagram
participant USER
participant MERCHANT
participant Ogloba API
participant Alipay
participant Ogloba DB
USER ->> MERCHANT: Show Alipay transaction order
MERCHANT ->> MERCHANT: Scan or input the Ogloba referenceNumber known as paymentRequestId
MERCHANT ->> MERCHANT: Input refund amount
MERCHANT ->> Ogloba API: Void
Ogloba API ->> Alipay: Initial a refund payment and send refund request
Alipay -->> Ogloba API: Return refund result
alt Refund success
Ogloba API ->> Ogloba DB: Void transaction
Ogloba DB -->> Ogloba API: Void response
alt Void fail
Ogloba API ->> Ogloba DB: Send alert
end
end
Ogloba API -->> MERCHANT: Void result
```
## Reconcile
[Overview](https://docs.alipayplus.com/alipayplus/alipayplus/reconcile_acq/reconcile_overview)
Alipay+ provides a set of financial reports to help Acquiring Service Providers (ACQPs) reconcile the transactions and settlements. ACQPs can download and use these reports to perform reconciliation
[Select reconciliation mode](https://docs.alipayplus.com/alipayplus/alipayplus/reconcile_acq/reconciliation_mode)
Alipay+ provides two reconciliation modes:
* Standard reconciliation: In this mode, Alipay+ performs only one batch of clearing and settlement for an ACQP, and provides only one set of report files.
* Multi-batch reconciliation: In this mode, Alipay+ performs multiple batches of clearing and settlement for an ACQP, and provides multiple sets of report files.
**<font color="red" size="3">Note: Need to check with Alipay how to set the reconciliation mode</font>**
[Perform reconciliation](https://docs.alipayplus.com/alipayplus/alipayplus/reconcile_acq/how_to_reconcile)
[Download reports](https://docs.alipayplus.com/alipayplus/alipayplus/reconcile_acq/download_report)
You can download the Alipay+ reconciliation reports from the Alipay+ SFTP server or Alipay+ Partner Workspace. Regardless of where you get the reports, the generation time and the content of the reports are the same.
[Transaction Detail Report](https://docs.alipayplus.com/alipayplus/alipayplus/reconcile_acq/trans_detail)
[Transaction Summary Report](https://docs.alipayplus.com/alipayplus/alipayplus/reconcile_acq/trans_summary)
[Fee Report](https://docs.alipayplus.com/alipayplus/alipayplus/reconcile_acq/fee)
[Settlement Report](https://docs.alipayplus.com/alipayplus/alipayplus/reconcile_acq/settlement)