Documentation
¶
Index ¶
- Constants
- Variables
- func AmountToPaise(amount float64) int64
- func MapRefundStatus(status string) string
- func MappingStatus(status string) string
- func MoneyFeeToString(moneyFee float64) string
- func New() payment.Driver
- func PaiseToAmount(paise int64) float64
- type Razorpay
- func (a *Razorpay) IsSupported(s config.Support) bool
- func (a *Razorpay) Pay(ctx echo.Context, cfg *config.Pay) (*config.PayResponse, error)
- func (a *Razorpay) PayNotify(ctx echo.Context) error
- func (a *Razorpay) PayQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)
- func (a *Razorpay) Refund(ctx echo.Context, cfg *config.Refund) (*config.Result, error)
- func (a *Razorpay) RefundNotify(ctx echo.Context) error
- func (a *Razorpay) RefundQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)
- func (a *Razorpay) SetAccount(account *config.Account) payment.Driver
- func (a *Razorpay) SetNotifyCallback(callback payment.NotifyCallback) payment.Driver
- func (a *Razorpay) VerifySign(ctx echo.Context) error
Constants ¶
const Name = `razorpay`
Variables ¶
var SupportedCurrencies = []string{
"INR", "USD", "EUR", "GBP", "AED", "AUD",
"CAD", "CHF", "HKD", "MYR", "SGD",
}
Functions ¶
func AmountToPaise ¶
AmountToPaise 金额转最小单位(Razorpay要求整数,如100=INR 1.00) 对于 INR 等货币,单位是 paisa (100 paisa = 1 rupee) 注意:Razorpay 对所有货币都使用最小单位(分/派沙)
func MapRefundStatus ¶
MapRefundStatus 映射 Razorpay 退款状态 状态文档: https://razorpay.com/docs/api/refunds/#refund-entity
func MappingStatus ¶
MappingStatus 映射 Razorpay 支付状态 状态文档: https://razorpay.com/docs/api/payments/#payment-entity
Types ¶
type Razorpay ¶
type Razorpay struct {
// contains filtered or unexported fields
}
func (*Razorpay) Pay ¶
Pay 创建 Razorpay Order 文档: https://razorpay.com/docs/api/orders/#create-an-order Razorpay 使用 Order + Payment 两步流程,前端拿到 order_id 后用 Checkout SDK 完成支付
func (*Razorpay) PayNotify ¶
PayNotify 处理 Webhook 回调(仅支付事件) 文档: https://razorpay.com/docs/webhooks/
func (*Razorpay) PayQuery ¶
PayQuery 查询支付状态(通过 Payment API) 文档: https://razorpay.com/docs/api/payments/#fetch-a-payment
func (*Razorpay) Refund ¶
Refund 发起退款 文档: https://razorpay.com/docs/api/refunds/#create-refund
func (*Razorpay) RefundNotify ¶
RefundNotify 处理退款通知(Razorpay退款webhook与支付共用同一endpoint) 此方法独立处理退款语义,仅响应 refund.* 事件 文档: https://razorpay.com/docs/webhooks/
func (*Razorpay) RefundQuery ¶
RefundQuery 查询退款状态 文档: https://razorpay.com/docs/api/refunds/#fetch-a-refund
func (*Razorpay) SetNotifyCallback ¶
func (a *Razorpay) SetNotifyCallback(callback payment.NotifyCallback) payment.Driver
func (*Razorpay) VerifySign ¶
VerifySign 验证 Razorpay Webhook 签名(HMAC-SHA256) 文档: https://razorpay.com/docs/signature-verification/ Razorpay 发送: X-Razorpay-Signature = HMAC-SHA256(raw_body, api_secret)