Overview
  • Namespace
  • Class

Namespaces

  • PayPal
    • Api
    • Auth
    • Cache
    • Common
    • Converter
    • Core
    • Exception
    • Handler
    • Log
    • Rest
    • Security
    • Transport
    • Validation

Classes

  • Address
  • Agreement
  • AgreementDetails
  • AgreementStateDescriptor
  • AgreementTransaction
  • AgreementTransactions
  • AlternatePayment
  • Amount
  • Authorization
  • BankAccount
  • BankAccountsList
  • BankToken
  • BaseAddress
  • Billing
  • BillingAgreementToken
  • BillingInfo
  • CancelNotification
  • Capture
  • CarrierAccount
  • CarrierAccountToken
  • CartBase
  • ChargeModel
  • Cost
  • CountryCode
  • CreateProfileResponse
  • Credit
  • CreditCard
  • CreditCardHistory
  • CreditCardList
  • CreditCardToken
  • CreditFinancingOffered
  • Currency
  • CurrencyConversion
  • CustomAmount
  • DetailedRefund
  • Details
  • Error
  • ErrorDetails
  • ExtendedBankAccount
  • ExternalFunding
  • FileAttachment
  • FlowConfig
  • FmfDetails
  • FundingDetail
  • FundingInstrument
  • FundingOption
  • FundingSource
  • FuturePayment
  • HyperSchema
  • Image
  • Incentive
  • InputFields
  • InstallmentInfo
  • InstallmentOption
  • Invoice
  • InvoiceAddress
  • InvoiceItem
  • InvoiceNumber
  • InvoiceSearchResponse
  • Item
  • ItemList
  • Links
  • Measurement
  • MerchantInfo
  • MerchantPreferences
  • Metadata
  • NameValuePair
  • Notification
  • OpenIdAddress
  • OpenIdError
  • OpenIdSession
  • OpenIdTokeninfo
  • OpenIdUserinfo
  • Order
  • OverrideChargeModel
  • Participant
  • Patch
  • PatchRequest
  • Payee
  • Payer
  • PayerInfo
  • Payment
  • PaymentCard
  • PaymentCardToken
  • PaymentDefinition
  • PaymentDetail
  • PaymentExecution
  • PaymentHistory
  • PaymentInstruction
  • PaymentOptions
  • PaymentSummary
  • PaymentTerm
  • Payout
  • PayoutBatch
  • PayoutBatchHeader
  • PayoutItem
  • PayoutItemDetails
  • PayoutSenderBatchHeader
  • Phone
  • Plan
  • PlanList
  • PotentialPayerInfo
  • Presentation
  • PrivateLabelCard
  • ProcessorResponse
  • RecipientBankingInstruction
  • RedirectUrls
  • Refund
  • RefundDetail
  • RefundRequest
  • RelatedResources
  • Sale
  • Search
  • ShippingAddress
  • ShippingCost
  • ShippingInfo
  • Tax
  • Template
  • TemplateData
  • Templates
  • TemplateSettings
  • TemplateSettingsMetadata
  • Terms
  • Transaction
  • TransactionBase
  • Transactions
  • VerifyWebhookSignature
  • VerifyWebhookSignatureResponse
  • Webhook
  • WebhookEvent
  • WebhookEventList
  • WebhookEventType
  • WebhookEventTypeList
  • WebhookList
  • WebProfile

Class Payment

Class Payment

Lets you create, process and manage payments.

PayPal\Common\PayPalModel
Extended by PayPal\Common\PayPalResourceModel implements PayPal\Rest\IResource
Extended by PayPal\Api\Payment

Direct known subclasses

PayPal\Api\FuturePayment

Namespace: PayPal\Api
Package: PayPal\Api
Located at PayPal/Api/Payment.php

Methods summary

public
# setId( string $id )

Identifier of the payment resource created.

Identifier of the payment resource created.

Parameters

$id

Returns


$this
public string
# getId( )

Identifier of the payment resource created.

Identifier of the payment resource created.

Returns

string
public
# setIntent( string $intent )

Payment intent. Valid Values: ["sale", "authorize", "order"]

Payment intent. Valid Values: ["sale", "authorize", "order"]

Parameters

$intent

Returns


$this
public string
# getIntent( )

Payment intent.

Payment intent.

Returns

string
public
# setPayer( PayPal\Api\Payer $payer )

Source of the funds for this payment represented by a PayPal account or a direct credit card.

Source of the funds for this payment represented by a PayPal account or a direct credit card.

Parameters

$payer

Returns


$this
public PayPal\Api\Payer
# getPayer( )

Source of the funds for this payment represented by a PayPal account or a direct credit card.

Source of the funds for this payment represented by a PayPal account or a direct credit card.

Returns

PayPal\Api\Payer
public
# setPotentialPayerInfo( PayPal\Api\PotentialPayerInfo $potential_payer_info )

Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.

Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.

Deprecated

Not publicly available

Parameters

$potential_payer_info

Returns


$this
public PayPal\Api\PotentialPayerInfo
# getPotentialPayerInfo( )

Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.

Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.

Deprecated

Not publicly available

Returns

PayPal\Api\PotentialPayerInfo
public
# setPayee( PayPal\Api\Payee $payee )

Receiver of funds for this payment.

Receiver of funds for this payment.

Parameters

$payee

Returns


$this
public PayPal\Api\Payee
# getPayee( )

Receiver of funds for this payment.

Receiver of funds for this payment.

Returns

PayPal\Api\Payee
public
# setCart( string $cart )

ID of the cart to execute the payment.

ID of the cart to execute the payment.

Deprecated

Not publicly available

Parameters

$cart

Returns


$this
public string
# getCart( )

ID of the cart to execute the payment.

ID of the cart to execute the payment.

Deprecated

Not publicly available

Returns

string
public
# setTransactions( PayPal\Api\Transaction[] $transactions )

Transactional details including the amount and item details.

Transactional details including the amount and item details.

Parameters

$transactions

Returns


$this
public PayPal\Api\Transaction[]
# getTransactions( )

Transactional details including the amount and item details.

Transactional details including the amount and item details.

Returns

PayPal\Api\Transaction[]
public
# addTransaction( PayPal\Api\Transaction $transaction )

Append Transactions to the list.

Append Transactions to the list.

Parameters

$transaction

Returns


$this
public
# removeTransaction( PayPal\Api\Transaction $transaction )

Remove Transactions from the list.

Remove Transactions from the list.

Parameters

$transaction

Returns


$this
public
# setFailedTransactions( PayPal\Api\Error[] $failed_transactions )

Applicable for advanced payments like multi seller payment (MSP) to support partial failures

Applicable for advanced payments like multi seller payment (MSP) to support partial failures

Deprecated

Not publicly available

Parameters

$failed_transactions

Returns


$this
public PayPal\Api\Error[]
# getFailedTransactions( )

Applicable for advanced payments like multi seller payment (MSP) to support partial failures

Applicable for advanced payments like multi seller payment (MSP) to support partial failures

Deprecated

Not publicly available

Returns

PayPal\Api\Error[]
public
# addFailedTransaction( PayPal\Api\Error $error )

Append FailedTransactions to the list.

Append FailedTransactions to the list.

Deprecated

Not publicly available

Parameters

$error

Returns


$this
public
# removeFailedTransaction( PayPal\Api\Error $error )

Remove FailedTransactions from the list.

Remove FailedTransactions from the list.

Deprecated

Not publicly available

Parameters

$error

Returns


$this
public
# setBillingAgreementTokens( string[] $billing_agreement_tokens )

Collection of PayPal generated billing agreement tokens.

Collection of PayPal generated billing agreement tokens.

Deprecated

Not publicly available

Parameters

$billing_agreement_tokens

Returns


$this
public string[]
# getBillingAgreementTokens( )

Collection of PayPal generated billing agreement tokens.

Collection of PayPal generated billing agreement tokens.

Deprecated

Not publicly available

Returns

string[]
public
# addBillingAgreementToken( string $billingAgreementToken )

Append BillingAgreementTokens to the list.

Append BillingAgreementTokens to the list.

Deprecated

Not publicly available

Parameters

$billingAgreementToken

Returns


$this
public
# removeBillingAgreementToken( string $billingAgreementToken )

Remove BillingAgreementTokens from the list.

Remove BillingAgreementTokens from the list.

Deprecated

Not publicly available

Parameters

$billingAgreementToken

Returns


$this
public
# setCreditFinancingOffered( PayPal\Api\CreditFinancingOffered $credit_financing_offered )

Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in

Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in

Deprecated

Not publicly available

Parameters

$credit_financing_offered

Returns


$this
public PayPal\Api\CreditFinancingOffered
# getCreditFinancingOffered( )

Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in

Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in

Deprecated

Not publicly available

Returns

PayPal\Api\CreditFinancingOffered
public
# setPaymentInstruction( PayPal\Api\PaymentInstruction $payment_instruction )

Instructions for the payer to complete this payment.

Instructions for the payer to complete this payment.

Deprecated

Not publicly available

Parameters

$payment_instruction

Returns


$this
public PayPal\Api\PaymentInstruction
# getPaymentInstruction( )

Instructions for the payer to complete this payment.

Instructions for the payer to complete this payment.

Deprecated

Not publicly available

Returns

PayPal\Api\PaymentInstruction
public
# setState( string $state )

The state of the payment, authorization, or order transaction. The value is:

  • created
    . The transaction was successfully created.
  • approved
    . The buyer approved the transaction.
  • failed
    . The transaction request failed.

Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"]

The state of the payment, authorization, or order transaction. The value is:

  • created
    . The transaction was successfully created.
  • approved
    . The buyer approved the transaction.
  • failed
    . The transaction request failed.

Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"]

Parameters

$state

Returns


$this
public string
# getState( )

The state of the payment, authorization, or order transaction. The value is:

  • created
    . The transaction was successfully created.
  • approved
    . The buyer approved the transaction.
  • failed
    . The transaction request failed.

The state of the payment, authorization, or order transaction. The value is:

  • created
    . The transaction was successfully created.
  • approved
    . The buyer approved the transaction.
  • failed
    . The transaction request failed.

Returns

string
public
# setExperienceProfileId( string $experience_profile_id )

PayPal generated identifier for the merchant's payment experience profile. Refer to this link to create experience profile ID.

PayPal generated identifier for the merchant's payment experience profile. Refer to this link to create experience profile ID.

Parameters

$experience_profile_id

Returns


$this
public string
# getExperienceProfileId( )

PayPal generated identifier for the merchant's payment experience profile. Refer to this link to create experience profile ID.

PayPal generated identifier for the merchant's payment experience profile. Refer to this link to create experience profile ID.

Returns

string
public
# setNoteToPayer( string $note_to_payer )

free-form field for the use of clients to pass in a message to the payer

free-form field for the use of clients to pass in a message to the payer

Parameters

$note_to_payer

Returns


$this
public string
# getNoteToPayer( )

free-form field for the use of clients to pass in a message to the payer

free-form field for the use of clients to pass in a message to the payer

Returns

string
public
# setRedirectUrls( PayPal\Api\RedirectUrls $redirect_urls )

Set of redirect URLs you provide only for PayPal-based payments.

Set of redirect URLs you provide only for PayPal-based payments.

Parameters

$redirect_urls

Returns


$this
public PayPal\Api\RedirectUrls
# getRedirectUrls( )

Set of redirect URLs you provide only for PayPal-based payments.

Set of redirect URLs you provide only for PayPal-based payments.

Returns

PayPal\Api\RedirectUrls
public
# setFailureReason( string $failure_reason )

Failure reason code returned when the payment failed for some valid reasons. Valid Values: ["UNABLE_TO_COMPLETE_TRANSACTION", "INVALID_PAYMENT_METHOD", "PAYER_CANNOT_PAY", "CANNOT_PAY_THIS_PAYEE", "REDIRECT_REQUIRED", "PAYEE_FILTER_RESTRICTIONS"]

Failure reason code returned when the payment failed for some valid reasons. Valid Values: ["UNABLE_TO_COMPLETE_TRANSACTION", "INVALID_PAYMENT_METHOD", "PAYER_CANNOT_PAY", "CANNOT_PAY_THIS_PAYEE", "REDIRECT_REQUIRED", "PAYEE_FILTER_RESTRICTIONS"]

Parameters

$failure_reason

Returns


$this
public string
# getFailureReason( )

Failure reason code returned when the payment failed for some valid reasons.

Failure reason code returned when the payment failed for some valid reasons.

Returns

string
public
# setCreateTime( string $create_time )

Payment creation time as defined in RFC 3339 Section 5.6.

Payment creation time as defined in RFC 3339 Section 5.6.

Parameters

$create_time

Returns


$this
public string
# getCreateTime( )

Payment creation time as defined in RFC 3339 Section 5.6.

Payment creation time as defined in RFC 3339 Section 5.6.

Returns

string
public
# setUpdateTime( string $update_time )

Payment update time as defined in RFC 3339 Section 5.6.

Payment update time as defined in RFC 3339 Section 5.6.

Parameters

$update_time

Returns


$this
public string
# getUpdateTime( )

Payment update time as defined in RFC 3339 Section 5.6.

Payment update time as defined in RFC 3339 Section 5.6.

Returns

string
public null|string
# getApprovalLink( )

Get Approval Link

Get Approval Link

Returns

null|string
public null|string
# getToken( )

Get token from Approval Link

Get token from Approval Link

Returns

null|string
public PayPal\Api\Payment
# create( PayPal\Rest\ApiContext $apiContext = null, PayPalRestCall $restCall = null )

Creates and processes a payment. In the JSON request body, include a payment object with the intent, payer, and transactions. For PayPal payments, include redirect URLs in the payment object.

Creates and processes a payment. In the JSON request body, include a payment object with the intent, payer, and transactions. For PayPal payments, include redirect URLs in the payment object.

Parameters

$apiContext
is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall
is the Rest Call Service that is used to make rest calls

Returns

PayPal\Api\Payment
public static PayPal\Api\Payment
# get( string $paymentId, PayPal\Rest\ApiContext $apiContext = null, PayPalRestCall $restCall = null )

Shows details for a payment, by ID.

Shows details for a payment, by ID.

Parameters

$paymentId
$apiContext
is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall
is the Rest Call Service that is used to make rest calls

Returns

PayPal\Api\Payment
public boolean
# update( PayPal\Api\PatchRequest $patchRequest, PayPal\Rest\ApiContext $apiContext = null, PayPalRestCall $restCall = null )

Partially updates a payment, by ID. You can update the amount, shipping address, invoice ID, and custom data. You cannot use patch after execute has been called.

Partially updates a payment, by ID. You can update the amount, shipping address, invoice ID, and custom data. You cannot use patch after execute has been called.

Parameters

$patchRequest
$apiContext
is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall
is the Rest Call Service that is used to make rest calls

Returns

boolean
public PayPal\Api\Payment
# execute( PayPal\Api\PaymentExecution $paymentExecution, PayPal\Rest\ApiContext $apiContext = null, PayPalRestCall $restCall = null )

Executes, or completes, a PayPal payment that the payer has approved. You can optionally update selective payment information when you execute a payment.

Executes, or completes, a PayPal payment that the payer has approved. You can optionally update selective payment information when you execute a payment.

Parameters

$paymentExecution
$apiContext
is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall
is the Rest Call Service that is used to make rest calls

Returns

PayPal\Api\Payment
public static PayPal\Api\PaymentHistory
# all( array $params, PayPal\Rest\ApiContext $apiContext = null, PayPalRestCall $restCall = null )

List payments that were made to the merchant who issues the request. Payments can be in any state.

List payments that were made to the merchant who issues the request. Payments can be in any state.

Parameters

$params
$apiContext
is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall
is the Rest Call Service that is used to make rest calls

Returns

PayPal\Api\PaymentHistory

Methods inherited from PayPal\Common\PayPalResourceModel

addLink(), executeCall(), getLink(), getLinks(), removeLink(), setLinks(), updateAccessToken()

Methods inherited from PayPal\Common\PayPalModel

__construct(), __get(), __isset(), __set(), __toString(), __unset(), fromArray(), fromJson(), getList(), setCredential(), toArray(), toJSON()

Properties summary

Properties inherited from PayPal\Common\PayPalModel

$credential

Magic properties

public PayPal\Api\Payee $payee
API documentation generated by ApiGen