Added paypal callbacks
This commit is contained in:
37
pages/paypal/success.go
Normal file
37
pages/paypal/success.go
Normal file
@ -0,0 +1,37 @@
|
||||
package paypal
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
)
|
||||
|
||||
// Success ...
|
||||
func Success(ctx *aero.Context) string {
|
||||
paymentID := ctx.Query("paymentId")
|
||||
// token := ctx.Query("token")
|
||||
// payerID := ctx.Query("PayerID")
|
||||
|
||||
c, err := arn.PayPal()
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusInternalServerError, "Could not initiate PayPal client", err)
|
||||
}
|
||||
|
||||
_, err = c.GetAccessToken()
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusInternalServerError, "Could not get PayPal access token", err)
|
||||
}
|
||||
|
||||
payment, err := c.GetPayment(paymentID)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusInternalServerError, "Could not retrieve payment information", err)
|
||||
}
|
||||
|
||||
arn.PrettyPrint(payment)
|
||||
|
||||
return ctx.HTML("success")
|
||||
}
|
Reference in New Issue
Block a user