Socket
Socket
Sign inDemoInstall

github.com/rmorriso/paypal

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/rmorriso/paypal

Package paypal defines types and operations used to access the Paypal API The following authorization operations are defined for Payment: authorization: lookup, capture, reauthorize, and void authorized payments The following billing-agreement operations are defined for payments: The following billing-plan operations are defined for payments: The following capture operations are defined for Payment: capture: lookup and refund captured payments The following identity operations are defined The following oreder operations are defined for Payment: order: manage orders The following payment operations are defined for Payment: payment: create,execute, update and lookup payments The following refund operations are defined for Payment: refund: lookup refund details Once a Payment is executed it becomes a Sale The following sale operations are defined for Payment: sale: lookup and refund completed payments


Version published

Readme

Source

Payment REST API Go client

Coverage Status GoDoc

This is a client for the Paypal REST API (https://developer.paypal.com/webapps/developer/docs/api/

Goals

  • Automated tests that don't require manual approval in Paypal account
  • Automated tests that require manual approval in a Paypal account (with a different build tag, eg. PAYPAL_APPROVED_PAYMENT_ID
  • Concurrency safety by utilizing PayPal-Request-Id

Usage

go get github.com/fundary/paypal

Import into your app and start using it:

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/fundary/paypal"
)

func main() {
	clientID := os.Getenv("PAYPAL_CLIENTID")
	if clientID == "" {
		panic("Paypal clientID is missing")
	}

	secret := os.Getenv("PAYPAL_SECRET")
	if secret == "" {
		panic("Paypal secret is missing")
	}

	client := paypal.NewClient(clientID, secret, paypal.APIBaseLive)

	payments, err := client.ListPayments(map[string]string{
		"count":   "10",
		"sort_by": "create_time",
	})
	if err != nil {
		log.Fatal("Could not retrieve payments: ", err)
	}

	fmt.Println(payments)
}

Run tests

This library use Goconvey for tests, so to run them, start Goconvey:

PAYPAL_TEST_CLIENTID=[Paypal Client ID] PAYPAL_TEST_SECRET=[Paypal Secret] goconvey

Or you can just use go test

PAYPAL_TEST_CLIENTID=[Paypal Client ID] PAYPAL_TEST_SECRET=[Paypal Secret] go test

Roadmap

FAQs

Last updated on 25 Feb 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc