razorpay

package
v0.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Name = `razorpay`

Variables

View Source
var SupportedCurrencies = []string{
	"INR", "USD", "EUR", "GBP", "AED", "AUD",
	"CAD", "CHF", "HKD", "MYR", "SGD",
}

Functions

func AmountToPaise

func AmountToPaise(amount float64) int64

AmountToPaise 金额转最小单位(Razorpay要求整数,如100=INR 1.00) 对于 INR 等货币,单位是 paisa (100 paisa = 1 rupee) 注意:Razorpay 对所有货币都使用最小单位(分/派沙)

func MapRefundStatus

func MapRefundStatus(status string) string

MapRefundStatus 映射 Razorpay 退款状态 状态文档: https://razorpay.com/docs/api/refunds/#refund-entity

func MappingStatus

func MappingStatus(status string) string

MappingStatus 映射 Razorpay 支付状态 状态文档: https://razorpay.com/docs/api/payments/#payment-entity

func MoneyFeeToString

func MoneyFeeToString(moneyFee float64) string

MoneyFeeToString 金额转字符串

func New

func New() payment.Driver

func PaiseToAmount

func PaiseToAmount(paise int64) float64

PaiseToAmount 最小单位转金额

Types

type Razorpay

type Razorpay struct {
	// contains filtered or unexported fields
}

func (*Razorpay) IsSupported

func (a *Razorpay) IsSupported(s config.Support) bool

func (*Razorpay) Pay

func (a *Razorpay) Pay(ctx echo.Context, cfg *config.Pay) (*config.PayResponse, error)

Pay 创建 Razorpay Order 文档: https://razorpay.com/docs/api/orders/#create-an-order Razorpay 使用 Order + Payment 两步流程,前端拿到 order_id 后用 Checkout SDK 完成支付

func (*Razorpay) PayNotify

func (a *Razorpay) PayNotify(ctx echo.Context) error

PayNotify 处理 Webhook 回调(仅支付事件) 文档: https://razorpay.com/docs/webhooks/

func (*Razorpay) PayQuery

func (a *Razorpay) PayQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)

PayQuery 查询支付状态(通过 Payment API) 文档: https://razorpay.com/docs/api/payments/#fetch-a-payment

func (*Razorpay) Refund

func (a *Razorpay) Refund(ctx echo.Context, cfg *config.Refund) (*config.Result, error)

Refund 发起退款 文档: https://razorpay.com/docs/api/refunds/#create-refund

func (*Razorpay) RefundNotify

func (a *Razorpay) RefundNotify(ctx echo.Context) error

RefundNotify 处理退款通知(Razorpay退款webhook与支付共用同一endpoint) 此方法独立处理退款语义,仅响应 refund.* 事件 文档: https://razorpay.com/docs/webhooks/

func (*Razorpay) RefundQuery

func (a *Razorpay) RefundQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)

RefundQuery 查询退款状态 文档: https://razorpay.com/docs/api/refunds/#fetch-a-refund

func (*Razorpay) SetAccount

func (a *Razorpay) SetAccount(account *config.Account) payment.Driver

func (*Razorpay) SetNotifyCallback

func (a *Razorpay) SetNotifyCallback(callback payment.NotifyCallback) payment.Driver

func (*Razorpay) VerifySign

func (a *Razorpay) VerifySign(ctx echo.Context) error

VerifySign 验证 Razorpay Webhook 签名(HMAC-SHA256) 文档: https://razorpay.com/docs/signature-verification/ Razorpay 发送: X-Razorpay-Signature = HMAC-SHA256(raw_body, api_secret)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL