Skip to content

Commit 2a79c58

Browse files
committed
Merge branch 'dev'
2 parents d6cdf23 + 1a6f688 commit 2a79c58

4 files changed

+101
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Common Payment System
2+
3+
ASP.NET Zero provides a payment system to get payments easily. In order to start a payment, just use `CreatePayment` method of `IPaymentManager`. You can create a new application service or you can use existing `CreatePayment` method of `PaymentAppService`. Then, you need to redirect user to `gateway-selection` route of `account` module as shown below;
4+
5+
```typescript
6+
this._router.navigate(
7+
['account/gateway-selection'],
8+
{
9+
queryParams: {
10+
paymentId: paymentId
11+
},
12+
}
13+
);
14+
```
15+
16+
ASP.NET Zero's common payment system will handle the rest of the payment flow.
17+
18+
- If the payment process is successfull, user will be redirected to `SuccessUrl` provided when creating the payment request.
19+
- If the payment process is unsuccessfull, user will be redirected to `ErrorUrl` provided when creating the payment request.
20+
- If `SuccessUrl` or `ErrorUrl` is not provided, user will be redirected to a common page and result of the payment process will be displayed.
21+
22+
## Creating Payment Request
23+
24+
### SubscriptionPayment Entity
25+
26+
`IPaymentManager` is used to create a payment requet. It's `CreatePayment` method requires a `SubscriptionPayment` entity. Here is the detials of `SubscriptionPayment` entity.
27+
28+
* `TenantId`: Represents which Tenant this payment request belongs to.
29+
* `PaymentPeriodType`: Period type of the payment if this is a payment for a specific period. Currently, Monthly and Annual are supported.
30+
* `DayCount`: Integer value of `PaymentPeriodType` field.
31+
* `Gateway`: Name of payment gateway which processed this payment. This is set by ASP.NET Zero when the payment is successfull.
32+
* `Status`: Status of payment. This is set by ASP.NET Zero.
33+
* `ExternalPaymentId`: Id of the payment in the external payment gateway system like Stripe or PayPal. This is set by ASP.NET Zero.
34+
* `InvoiceNo`: Invoice number if an invoice generated in ASP.NET Zero for this payment.
35+
* `SuccessUrl`: URL to redirect user if payment is successfull.
36+
* `ErrorUrl`: URL to redirect user if payment is failed.
37+
* `IsRecurring`: Represents if this is a recurring payment or not. If it is recurring, user's credit card will be charged at the end of every payment cycle. This is only supported by Stripe at the moment.
38+
* `IsProrationPayment`: This is a special field. If the tenant is on a recurring payment plan and operation is upgrade, then it is a proration payment.
39+
* `ExtraProperties`: A dictionary to store additional information on the payment object.
40+
* `SubscriptionPaymentProducts`: List of products to be purchased for this payment.
41+
42+
### SubscriptionPaymentProduct Entity
43+
44+
* `SubscriptionPaymentId`: Id of the related payment record.
45+
* `Description`: Description of the purchased product.
46+
* `Amount`: Price of the product.
47+
* `Count`: Count of products to be purchased.
48+
* `TotalAmount`: Total price of products to be purchased.
49+
* `ExtraProperties`: A dictionary to store additional information on the product object.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Common Payment System
2+
3+
ASP.NET Zero provides a payment system to get payments easily. In order to start a payment, just use `CreatePayment` method of `IPaymentManager` and then redirect user to `GatewaySelection` action of `PaymentController` with the created paymentId. For example, a sample URL for the `paymentId=1` should be like this;
4+
5+
```bash
6+
https://localhost:44302/Payment/GatewaySelection?paymentId=1
7+
```
8+
9+
ASP.NET Zero's common payment system will handle the rest of the payment flow.
10+
11+
- If the payment process is successfull, user will be redirected to `SuccessUrl` provided when creating the payment request.
12+
- If the payment process is unsuccessfull, user will be redirected to `ErrorUrl` provided when creating the payment request.
13+
- If `SuccessUrl` or `ErrorUrl` is not provided, user will be redirected to a common page and result of the payment process will be displayed.
14+
15+
## Creating Payment Request
16+
17+
### SubscriptionPayment Entity
18+
19+
`IPaymentManager` is used to create a payment requet. It's `CreatePayment` method requires a `SubscriptionPayment` entity. Here is the detials of `SubscriptionPayment` entity.
20+
21+
* `TenantId`: Represents which Tenant this payment request belongs to.
22+
* `PaymentPeriodType`: Period type of the payment if this is a payment for a specific period. Currently, Monthly and Annual are supported.
23+
* `DayCount`: Integer value of `PaymentPeriodType` field.
24+
* `Gateway`: Name of payment gateway which processed this payment. This is set by ASP.NET Zero when the payment is successfull.
25+
* `Status`: Status of payment. This is set by ASP.NET Zero.
26+
* `ExternalPaymentId`: Id of the payment in the external payment gateway system like Stripe or PayPal. This is set by ASP.NET Zero.
27+
* `InvoiceNo`: Invoice number if an invoice generated in ASP.NET Zero for this payment.
28+
* `SuccessUrl`: URL to redirect user if payment is successfull.
29+
* `ErrorUrl`: URL to redirect user if payment is failed.
30+
* `IsRecurring`: Represents if this is a recurring payment or not. If it is recurring, user's credit card will be charged at the end of every payment cycle. This is only supported by Stripe at the moment.
31+
* `IsProrationPayment`: This is a special field. If the tenant is on a recurring payment plan and operation is upgrade, then it is a proration payment.
32+
* `ExtraProperties`: A dictionary to store additional information on the payment object.
33+
* `SubscriptionPaymentProducts`: List of products to be purchased for this payment.
34+
35+
### SubscriptionPaymentProduct Entity
36+
37+
* `SubscriptionPaymentId`: Id of the related payment record.
38+
* `Description`: Description of the purchased product.
39+
* `Amount`: Price of the product.
40+
* `Count`: Count of products to be purchased.
41+
* `TotalAmount`: Total price of products to be purchased.
42+
* `ExtraProperties`: A dictionary to store additional information on the product object.

docs/en/nav-aspnet-core-angular.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,11 @@
363363
{
364364
"text": "UI Testing",
365365
"path": "Playwright-UI-Testing-Angular.md"
366-
}
366+
},
367+
{
368+
"text": "Common Payment System",
369+
"path": "Features-Angular-Common-Payment-System.md"
370+
}
367371
]
368372
},
369373
{

docs/en/nav-aspnet-core-mvc.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,11 @@
393393
{
394394
"text": "UI Testing",
395395
"path": "Playwright-UI-Testing.md"
396-
}
396+
},
397+
{
398+
"text": "Common Payment System",
399+
"path": "Features-Mvc-Core-Common-Payment-System.md"
400+
}
397401
]
398402
},
399403
{

0 commit comments

Comments
 (0)