paypal-adaptive-hoops-0.9.0.0: Client for a limited part of PayPal's Adaptive Payments API

Safe HaskellNone
LanguageHaskell2010

Web.PayPal.Adaptive

Synopsis

Documentation

data Client Source

Constructors

Client 

Fields

_clAppId :: Text
 
_clUserId :: Text
 
_clEnv :: Env
 
_clPassword :: Text
 
_clSig :: Text
 
_clAccountEmail :: Text

Not needed for authentication, but deposits are sent to here and withdrawals are sent from here. Must be the email associated with your PayPal app.

Instances

data Env Source

Constructors

Sandbox 
Production 

Instances

class AdaptiveAPI a where Source

Instances

AdaptiveAPI Deposit 
AdaptiveAPI Withdrawal

Sending a payment to a PayPal account that doesn't exist yet returns a PayResp with an empty list of PayInfos. We return this as Left AePending.

AdaptiveAPI (LookupPayment a) 

data AdaptiveErr Source

Text is an error message in all the below types.

AeShouldNotHappen is meant to cover PayPal responses to API requests that this library doesn't support sending in the first place. TODO: is this actually how we're using it?

Constructors

AeConnectionErr Text 
AeDecodeFailed ByteString Text 
AeInvalidCredentials

AeInvalidCredentials just a wrapper around an AeErrCodes Int.

AeNoSuchEmail

AeNoSuchEmail is just a wrapper around an AeErrCodes Int. It's raised when the Deposit sender email or the Withdrawal account email doesn't exist.

AeErrCodes [Int] 
AePending PayResp 
AeRefused PayResp 
AeShouldNotHappen PayResp Text 

data Withdrawal Source

Send a single payment from your account.

Pay operation docs: https://developer.paypal.com/docs/classic/api/adaptive-payments/Pay_API_Operation/

This is a "Simple Payment" which means there's a single sender and receiver (same as Deposit).

It uses the Implicit payment approval type, meaning the application making the API call must also be the sender of the payment.

Instances

Eq Withdrawal 
Show Withdrawal 
Default Withdrawal 
AdaptiveAPI Withdrawal

Sending a payment to a PayPal account that doesn't exist yet returns a PayResp with an empty list of PayInfos. We return this as Left AePending.

data Deposit Source

Start the process of someone paying you. You have to redirect the payer's browser to PayPal to finish it.

Pay operation docs: https://developer.paypal.com/docs/classic/api/adaptive-payments/Pay_API_Operation/

This is a "Simple Payment" which means there's a single sender and receiver (same as Withdrawal).

It uses the Explicit payment approval type, meaning the payer must go to PayPal in their browser to approve the payment. Here's an example payment approval URL with a PayKey of "foo":

https://www.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=foo

data PayInfo Source

Right toPayPal responses return a PayInfo along with a _piTransactionStatus Just, with some exceptions.

  1. Withdrawals to nonexistent accounts return no PayInfos.

    1. Lookups on such transactions return one PayInfo with a _piTransactionStatus of Nothing.
    2. Deposits don't return PayInfos.
    3. Lookups on such transactions return one PayInfo with a _piTransactionStatus of Nothing.

NOTE: We use the same newtype for both _piSenderTransactionId and _piTransactionStatus. They will have different values, but either can be used to look up a payment.

data Money Source

Constructors

USD 

Fields

_usdCents :: Int
 

Instances