Documentation
¶
Overview ¶
Package alipayslim is a slim version of the Alipay API.
Index ¶
- type Client
- func (c *Client) AlipayHKAppPayParams() *PayParams
- func (c *Client) MustWithRSAKey(key string) *Client
- func (c *Client) SingleTradeQuery(ctx context.Context, tradeNo string) (*TradeQuery, error)
- func (c *Client) WithDebug(debug bool) *Client
- func (c *Client) WithMD5Key(key string) *Client
- func (c *Client) WithRSAKey(key string) (*Client, error)
- type PayParams
- func (p *PayParams) OrderString() (string, error)
- func (p *PayParams) WithBody(body string) *PayParams
- func (p *PayParams) WithNotifyUrl(notifyUrl string) *PayParams
- func (p *PayParams) WithOutTradeNo(tradeNo string) *PayParams
- func (p *PayParams) WithReferUrl(referUrl string) *PayParams
- func (p *PayParams) WithSubject(subject string) *PayParams
- func (p *PayParams) WithTotalFee(totalFee string) *PayParams
- type Time
- type TradeQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the client for the Alipay API.
func (*Client) AlipayHKAppPayParams ¶
AlipayHKAppPayParams returns a new basic parameters for the AlipayHK app pay.
func (*Client) MustWithRSAKey ¶
MustWithRSAKey is like WithRSAKey but panics if the key is invalid.
func (*Client) SingleTradeQuery ¶
Call this interface to obtain the information of a particular transaction, such as the transaction ID, out_trade_no, and transaction status. https://global.alipay.com/docs/ac/hkapi/single_trade_query
func (*Client) WithMD5Key ¶
WithMD5Key sets the MD5 key and returns the client.
type PayParams ¶
PayParams is the parameters for the Alipay pay.
func (*PayParams) OrderString ¶
OrderString returns the order string for the Alipay HK app pay.
func (*PayParams) WithNotifyUrl ¶
WithNotifyUrl sets the notify URL and returns the PayParams.
func (*PayParams) WithOutTradeNo ¶
WithOutTradeNo sets the out trade no and returns the PayParams.
func (*PayParams) WithReferUrl ¶
WithReferUrl sets the refer URL and returns the PayParams.
func (*PayParams) WithSubject ¶
WithSubject sets the subject and returns the PayParams.
func (*PayParams) WithTotalFee ¶
WithTotalFee sets the total fee and returns the PayParams.
type Time ¶
Time is the time in UTC+8.
func (Time) MarshalXML ¶
MarshalXML is the method to marshal the time to XML.
func (*Time) UnmarshalXML ¶
UnmarshalXML is the method to unmarshal the time from XML.
type TradeQuery ¶
type TradeQuery struct {
// Detailed description about the goods. Special characters are not supported.
Body string `xml:"body"`
// Buyer’s Alipay account.
BuyerEmail string `xml:"buyer_email"`
// The unique buyer ID assigned by Alipay.
BuyerID string `xml:"buyer_id"`
// The discount amount.
Discount string `xml:"discount"`
// Indicates whether the trade transaction is locked. If the value is 1, the transaction is locked. If the value is 0, the transaction is not locked.
FlagTradeLocked string `xml:"flag_trade_locked"`
// The time when the transaction is created. Format: yyyy-MM-dd HH:mm:ss. Use GMT+8.
GmtCreate Time `xml:"gmt_create"`
// The last time when the value of total_fee is modified. Format: yyyy-MM-dd HH:mm:ss. Use GMT +8.
GmtLastModifiedTime Time `xml:"gmt_last_modified_time"`
// The time when the transaction is paid by the buyer. Format: yyyy-MM-dd HH:mm:ss. Use GMT+8.
GmtPayment Time `xml:"gmt_payment"`
// Indicates whether the total fee is adjusted. The value is T for the adjusted total fee and F for the non-adjusted total fee.
IsTotalFeeAdjust string `xml:"is_total_fee_adjust"`
// The operator role, with a value of B for buyers or S for sellers.
OperatorRole string `xml:"operator_role"`
// The unique transaction ID that is assigned by the partner.
OutTradeNo string `xml:"out_trade_no"`
// The payment type.
PaymentType string `xml:"payment_type"`
// Goods prices, which is accurate to 2 digits after the decimal point. The unit is RMB and the value is in the range 0.01 - 100000000.00. The unit is HKD when the buyer paid by Alipay HK.
Price string `xml:"price"`
// The quantity of goods.
Quantity string `xml:"quantity"`
// Partner Alipay account.
SellerEmail string `xml:"seller_email"`
// A unique seller ID assigned by Alipay. This 16-digit number begins with 2088.
SellerID string `xml:"seller_id"`
// Brief description of the transaction. Special characters are not supported. Note: The value of this field will be displayed to customers.
Subject string `xml:"subject"`
// The accumulative refunded amount paid to the buyer.
ToBuyerFee string `xml:"to_buyer_fee"`
// The accumulative amount paid to the seller.
ToSellerFee string `xml:"to_seller_fee"`
// The transaction amount in CNY. It is the exact amount that the buyer has paid. Accurate to two decimal places. The transaction amount is in HKD when the buyer paid by Alipay HK.
TotalFee string `xml:"total_fee"`
// The unique transaction ID assigned by Alipay, with a length in the range 16 - 64 bits. If out_trade_no and trade_no appear at the same time, trade_no takes precedence.
TradeNo string `xml:"trade_no"`
// TradeStatus is used to describe the status of an Online Payment transaction in the specific interfaces. Possible values are:
// WAIT_BUYER_PAY: The transaction is created and is waiting for the customer to pay.
// TRADE_FINISHED: The transaction is paid. This status persists even if partial refunds or full refunds occur, or when the refund period is expired.
// TRADE_CLOSED: The transaction is closed because of payment timeout.
TradeStatus string `xml:"trade_status"`
// Indicates whether the Alipay coupon is used in the transaction. The value can be T for a used coupon and F a coupon that is not used.
UseCoupon string `xml:"use_coupon"`
}
TradeQuery is the response of SingleTradeQuery.
func (TradeQuery) IsPaid ¶
func (t TradeQuery) IsPaid() bool
Return true if the transaction is paid.