Wt: Wt::Payment::PayPalExpressCheckout Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions
Wt::Payment::PayPalExpressCheckout Class Reference
Payment module (Wt::Payment)

A paypal express checkout process. More...

`#include <Wt/Payment/Paypal>`

Inheritance diagram for Wt::Payment::PayPalExpressCheckout:
[legend]

List of all members.

## Public Types
enum | PaymentAction { SaleAction, AuthorizationAction, OrderAction }
| Enumeration for payment actions. More...
## Public Member Functions
void | setPaymentAction (PaymentAction action)
| Sets the payment action.
PaymentAction | paymentAction () const
| Returns the payment action.
void | setParameter (const std::string &name, const std::string &value)
| Adds or overrides a PayPal API request parameter.
const Customer & | customer () const
| Returns the customer information.
const Order & | order () const
| Returns the order information.
Signal< Result > & | setup ()
| Setup the transaction.
void | startPayment ()
| Start the payment.
Signal< Result > & | updateCustomerDetails ()
| Updates customer information from PayPal.
Signal< Result > & | completePayment (const Money &totalAmount)
| Completes the payment.
Signal< Approval > & | paymentApproved ()
| The payment approval signal.

## Detailed Description

A paypal express checkout process.

This implements the PayPal Express Checkout process.

For more information about the PayPal API see: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECGettingStarted

Use flow:

1. use PayPalService to create a PayPalExpressCheckout instance.
2. setup() - sends SetExpressCheckout API call returns a result signal.
3. startPayment() - Redirects to PayPal. Use it after receiving the setup() result signal.
4. paymentApproved signal will be emitted with the result of SetExpressCheckout API call.
5. updateCustomerDetails() - GetExpressCheckoutDetails API call returns a result signal.
6. completePayment() - DoExpressCheckoutPayment API call returns a result signal.

For an example, see the paypal feature example.

See also:
  PayPalService

## Member Enumeration Documentation

enum Wt::Payment::PayPalExpressCheckout::PaymentAction

Enumeration for payment actions.

See more information at PayPal:

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout

See also:
  setPaymentAction()

Enumerator:

  SaleAction | A Sale action.
  AuthorizationAction | An Authorization action.
  OrderAction | An Order action.

## Member Function Documentation

Signal< Result > & Wt::Payment::PayPalExpressCheckout::completePayment | ( | const Money & | totalAmount | ) |

Completes the payment.

This is the last step of a PayPal checkout, which uses the PayPal DoExpressCheckoutPayment API call to confirm the payment.

This may update the exact amount (for example to reflect accurate shipping information knowing the customer's shipping address).

This is an asynchronous call, which returns a signal that is emitted when the call has finished.

const Customer & Wt::Payment::PayPalExpressCheckout::customer | ( |  | ) | const

Returns the customer information.

See also:
  Customer

const Order & Wt::Payment::PayPalExpressCheckout::order | ( |  | ) | const

Returns the order information.

See also:
  Order

PayPalExpressCheckout::PaymentAction Wt::Payment::PayPalExpressCheckout::paymentAction | ( |  | ) | const

Returns the payment action.

See also:
  setPaymentAction()

Signal< Approval > & Wt::Payment::PayPalExpressCheckout::paymentApproved | ( |  | ) |

The payment approval signal.

See also:
  startPayment()

void Wt::Payment::PayPalExpressCheckout::setParameter | ( | const std::string & | name,
|  | const std::string & | value
| ) |  |

Adds or overrides a PayPal API request parameter.

If value is empty, then this will remove a request parameter.

Useful use examples:

      //send to paypal - &REQCONFIRMSHIPPING=1
      setParameter("REQCONFIRMSHIPPING", 1);

     //send to paypal - &NOSHIPPING=1
      setParameter("NOSHIPPING", 1);

     //send to paypal - &LOGOIMG=https://www.../logo.gif
      setParameter("LOGOIMG", "https://www.../logo.gif");

     //send to paypal - &CARTBORDERCOLOR=00CD
      setParameter("CARTBORDERCOLOR", "00CD");

void Wt::Payment::PayPalExpressCheckout::setPaymentAction | ( | PaymentAction | action | ) |

Sets the payment action.

The default payment action is SaleAction.

Signal< Result > & Wt::Payment::PayPalExpressCheckout::setup | ( |  | ) |

Setup the transaction.

This uses the PayPal SetExpressCheckout API call to initiate the payment process, preparing things for a subsequent call to startPayment().

This is an asynchronous call, which returns a signal that is emitted when the call has finished.

void Wt::Payment::PayPalExpressCheckout::startPayment | ( |  | ) |

Start the payment.

This redirects to PayPal. It should be directly connected to a clicked event (on the PayPal button), to allow a JavaScript popup window to be used.

This is an asynchronous call, whose result will be indicated using the paymentApproved() signal.

Signal< Result > & Wt::Payment::PayPalExpressCheckout::updateCustomerDetails | ( |  | ) |

Updates customer information from PayPal.

This fetches customer information that is kept at PayPal for the current user. This call is optional, and can be used only after the user approved the payment (see paymentApproved()).

This uses the PayPal GetExpressCheckoutDetails API call.

This is an asynchronous call, which returns a signal that is emitted when the call has finished.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator