├── .gitignore ├── .travis.yml ├── Logging.md ├── README.md ├── Resources ├── AlternativeConfiguration.php ├── Configuration.php ├── ConfigurationWithMLE.php ├── ExternalConfiguration.php ├── MerchantBoardingConfiguration.php ├── NetworkTokenCert.pem ├── TRRReport.json ├── authRequest.json ├── autoload.php ├── cacert.pem ├── createPayment.json ├── cybs.json ├── payloadData.php ├── putPayment.json ├── testrest.p12 └── testrest_cpctv.p12 ├── Samples ├── AccountUpdater │ ├── AmexRegistrationCustomerTokenBatch.php │ ├── AmexRegistrationInstrumentIdentifierTokenBatch.php │ ├── ListBatches.php │ ├── OneOffVisaMasterCardCustomerTokenBatch.php │ ├── OneOffVisaMasterCardInstrumentIdentifierTokenBatch.php │ ├── RetrieveBatchReport.php │ └── RetrieveBatchStatus.php ├── Authentication │ ├── StandAloneHttpSignature.php │ ├── StandAloneJWT.php │ ├── StandAloneMetaKey.php │ ├── StandAloneOAuth.php │ ├── deleteMethod.php │ ├── getGenerateHeaders.php │ ├── getMethod.php │ ├── postGenerateHeaders.php │ ├── postMethod.php │ ├── postMethodJsonModel.php │ ├── putGenerateHeaders.php │ └── putMethod.php ├── AzureIntermediateTesting │ └── IntermediateHostTesting.php ├── BinLookup │ ├── BINLookupWithCard.php │ ├── BINLookupWithHealthcareCard.php │ ├── BINLookupWithNetworkToken.php │ ├── BINLookupWithTMSCustomerID.php │ ├── BINLookupWithTMSInstrumentIdentifier.php │ ├── BINLookupWithTMSJWTTransientToken.php │ ├── BINLookupWithTMSJtiTransientToken.php │ └── BINLookupWithTMSPaymentInstrument.php ├── BulkBoarding │ └── BulkBoarding │ │ ├── Csv2Json.php │ │ ├── MerchantBoardingAgent.php │ │ └── Report.php ├── FlexMicroform │ ├── GenerateCaptureContextAcceptCard.php │ └── GenerateCaptureContextAcceptCheck.php ├── Invoicing │ ├── InvoiceSettings │ │ ├── GetInvoiceSettings.php │ │ └── UpdateInvoiceSettings.php │ └── Invoices │ │ ├── CancelInvoice.php │ │ ├── CreateAndSendInvoiceImmediately.php │ │ ├── CreateDraftInvoice.php │ │ ├── CreateInvoiceAndAssignItSpecificInvoiceNumber.php │ │ ├── CreateInvoiceWithoutSendingIt.php │ │ ├── GetInvoiceDetails.php │ │ ├── GetListOfInvoices.php │ │ ├── SendInvoice.php │ │ └── UpdateInvoice.php ├── MLEFeature │ ├── SimpleAuthorizationInternetWithGlobalMLE.php │ ├── SimpleAuthorizationInternetWithMapControlMLE.php │ └── SimpleAuthorizationInternetWithMapControlMLE2.php ├── MerchantBoarding │ ├── CreateRegistration.php │ ├── MerchantBoardingAmexDirect.php │ ├── MerchantBoardingBarclays.php │ ├── MerchantBoardingBinLookUp.php │ ├── MerchantBoardingCUP.php │ ├── MerchantBoardingEFTPOS.php │ ├── MerchantBoardingFDIGlobal.php │ ├── MerchantBoardingGPX.php │ ├── MerchantBoardingSmartFDC.php │ ├── MerchantBoardingTSYS.php │ └── MerchantBoardingVPC.php ├── NetworkTokenization │ ├── CreateInstrumentIdentifierCardEnrollForNetworkToken.php │ ├── NetworkToken.php │ └── PaymentCredentialsFromNetworkToken.php ├── PayerAuthentication │ ├── AuthenticationWithNORedirect.php │ ├── AuthenticationWithNewAccount.php │ ├── EnrollWithCustomerIdAsPaymentInformation.php │ ├── EnrollWithPendingAuthentication.php │ ├── EnrollWithTransientToken.php │ ├── EnrollWithTravelInformation.php │ ├── PendingAuthenticationWithUnknownPath.php │ ├── SetupCompletionWithCardNumber.php │ ├── SetupCompletionWithFlexTransientToken.php │ ├── SetupCompletionWithFluidDataValueAndPaymentSolution.php │ ├── SetupCompletionWithSecureStorageToken.php │ ├── SetupCompletionWithTMSToken.php │ ├── SetupCompletionWithTokenizedCard.php │ └── ValidateAuthenticationResults.php ├── Payments │ ├── Capture │ │ ├── CaptureOfAuthorizationThatUsedSwipedTrackData.php │ │ ├── CapturePayment.php │ │ ├── CapturePaymentServiceFee.php │ │ └── RestaurantCaptureWithGratuity.php │ ├── Credit │ │ ├── Credit.php │ │ ├── CreditUsingBluefinPCIP2PEForCardPresentEnabledAcquirer.php │ │ ├── CreditUsingBluefinPCIP2PEWithVisaPlatformConnect.php │ │ ├── CreditWithCustomerPaymentInstrumentAndShippingAddressTokenId.php │ │ ├── CreditWithCustomerTokenId.php │ │ ├── CreditWithInstrumentIdentifierTokenId.php │ │ ├── EBTMerchandiseReturnCreditVoucherFromSNAP.php │ │ ├── ElectronicCheckStandAloneCredits.php │ │ ├── PinDebitCreditUsingEMVTechnologyWithContactlessReadWithVisaPlatformConnect.php │ │ ├── PinDebitCreditUsingSwipedTrackDataWithVisaPlatformConnect.php │ │ └── ServiceFeesCredit.php │ ├── Payments │ │ ├── AmericanExpressDirectEMVWithContactRead.php │ │ ├── AuthorizationCaptureForTimeoutVoidFlow.php │ │ ├── AuthorizationForIncrementalAuthorizationFlow.php │ │ ├── AuthorizationForTimeoutReversalFlow.php │ │ ├── AuthorizationSkipDecisionManagerForSingleTransaction.php │ │ ├── AuthorizationUsingBluefinPCIP2PEForCardPresentEnabledAcquirer.php │ │ ├── AuthorizationUsingBluefinPCIP2PEWithVisaPlatformConnect.php │ │ ├── AuthorizationUsingSwipedTrackData.php │ │ ├── AuthorizationWithCaptureSale.php │ │ ├── AuthorizationWithCustomerPaymentInstrumentAndShippingAddressTokenId.php │ │ ├── AuthorizationWithCustomerTokenCreation.php │ │ ├── AuthorizationWithCustomerTokenDefaultPaymentInstrumentAndShippingAddressCreation.php │ │ ├── AuthorizationWithCustomerTokenId.php │ │ ├── AuthorizationWithDMAcceptPAEnroll.php │ │ ├── AuthorizationWithDMRejectPAEnroll.php │ │ ├── AuthorizationWithDMReviewPAEnroll.php │ │ ├── AuthorizationWithDecisionManager.php │ │ ├── AuthorizationWithDecisionManagerBuyerInformation.php │ │ ├── AuthorizationWithDecisionManagerCustomSetup.php │ │ ├── AuthorizationWithDecisionManagerDeviceInformation.php │ │ ├── AuthorizationWithDecisionManagerMerchantDefinedInformation.php │ │ ├── AuthorizationWithDecisionManagerShippingInformation.php │ │ ├── AuthorizationWithDecisionManagerTravelInformation.php │ │ ├── AuthorizationWithInstrumentIdentifierTokenCreation.php │ │ ├── AuthorizationWithInstrumentIdentifierTokenId.php │ │ ├── AuthorizationWithLegacyToken.php │ │ ├── AuthorizationWithPAEnrollAuthenticationNeeded.php │ │ ├── AuthorizationWithPayerAuthValidation.php │ │ ├── AuthorizationWithTMSTokenBypassingNetworkToken.php │ │ ├── CITInitiatingInstalmentSubscriptionUK.php │ │ ├── CITInitiatingRecurringSubscription.php │ │ ├── CITPlacingCredentialOnFile.php │ │ ├── DigitalPaymentGooglePay.php │ │ ├── DigitalPaymentsApplePay.php │ │ ├── EBTElectronicVoucherPurchaseFromSNAPAccountWithVisaPlatformConnect.php │ │ ├── EBTPurchaseFromCashBenefitsAccountWithCashback.php │ │ ├── EBTPurchaseFromSNAPAccountWithVisaPlatformConnect.php │ │ ├── ElectronicCheckDebits.php │ │ ├── ElectronicCheckDebitsWithLegacyToken.php │ │ ├── IncrementalAuthorization.php │ │ ├── LevelIIData.php │ │ ├── LevelIIIData.php │ │ ├── MITIndustryPracticeDelayedCharge3RIVisa.php │ │ ├── MITIndustryPracticeResubmission.php │ │ ├── MITInstalment.php │ │ ├── MITRecurring.php │ │ ├── MITUnscheduledCredentialOnFile.php │ │ ├── PartialAuthorization.php │ │ ├── PaymentNetworkTokenization.php │ │ ├── PaymentWithFlexToken.php │ │ ├── PaymentWithFlexTokenCreatePermanentTMSToken.php │ │ ├── PinDebitPurchaseUsingEMVTechnologyWithContactlessReadWithVisaPlatformConnect.php │ │ ├── PinDebitPurchaseUsingSwipedTrackDataWithVisaPlatformConnect.php │ │ ├── RestaurantAuthorization.php │ │ ├── SaleUsingEMVTechnologyWithContactReadOneForCardPresentEnabledAcquirer.php │ │ ├── SaleUsingEMVTechnologyWithContactReadTwoForCardPresentEnabledAcquirer.php │ │ ├── SaleUsingEMVTechnologyWithContactReadWithVisaPlatformConnect.php │ │ ├── SaleUsingEMVTechnologyWithContactless.php │ │ ├── SaleUsingEMVTechnologyWithContactlessReadForCardPresentEnabledAcquirer.php │ │ ├── SaleUsingEMVTechnologyWithContactlessReadWithVisaPlatformConnect.php │ │ ├── SaleUsingKeyedDataForCardPresentEnabledAcquirer.php │ │ ├── SaleUsingKeyedDataWithBalanceInquiry.php │ │ ├── SaleUsingKeyedDataWithVisaPlatformConnect.php │ │ ├── SaleUsingSwipedTrackDataForCardPresentEnabledAcquirer.php │ │ ├── SaleUsingSwipedTrackDataWithVisaPlatformConnect.php │ │ ├── ServiceFeesWithCreditCardTransaction.php │ │ ├── SimpleAuthorizationInternet.php │ │ ├── Swiped.php │ │ └── ZeroDollarAuthorization.php │ ├── Refund │ │ ├── ElectronicCheckFollowonRefund.php │ │ ├── RefundCapture.php │ │ └── RefundPayment.php │ ├── Reversal │ │ ├── ProcessAuthorizationReversal.php │ │ ├── ServiceFeesAuthorizationReversal.php │ │ └── TimeoutReversal.php │ └── Void │ │ ├── EBTReversalOfPurchaseFromSNAPAccount.php │ │ ├── PinDebitPurchaseReversalVoid.php │ │ ├── TimeoutVoid.php │ │ ├── VoidCapture.php │ │ ├── VoidCredit.php │ │ ├── VoidPayment.php │ │ └── VoidRefund.php ├── Payouts │ ├── PayoutCardNotToken.php │ └── PayoutToken.php ├── RecurringBillingSubscriptions │ ├── Plans │ │ ├── ActivatePlan.php │ │ ├── CreatePlan.php │ │ ├── DeactivatePlan.php │ │ ├── DeletePlan.php │ │ ├── GetListOfPlans.php │ │ ├── GetPlan.php │ │ ├── GetPlanCode.php │ │ └── UpdatePlan.php │ └── Subscriptions │ │ ├── ActivateSubscription.php │ │ ├── CancelSubscription.php │ │ ├── CreateSubscription.php │ │ ├── GetListOfSubscriptions.php │ │ ├── GetSubscription.php │ │ ├── GetSubscriptionCode.php │ │ ├── SuspendSubscription.php │ │ └── UpdateSubscription.php ├── Reporting │ ├── ChargebackDetails │ │ └── GetChargebackDetails.php │ ├── ChargebackSummaries │ │ └── GetChargebackSummaries.php │ ├── ConversionDetails │ │ └── GetConversionDetailTransactions.php │ ├── InterchangeClearingLevelDetails │ │ └── InterchangeClearingLevelDataForAccountOrMerchant.php │ ├── NetFundings │ │ └── GetNetfundingInformationForAccountOrMerchant.php │ ├── NotificationOfChanges │ │ └── GetNotificationOfChanges.php │ ├── PaymentBatchSummaries │ │ └── GetPaymentBatchSummaryData.php │ ├── PurchaseAndRefundDetails │ │ └── GetPurchaseAndRefundDetails.php │ ├── ReportDefinitions │ │ ├── GetReportDefinition.php │ │ └── GetReportingResourceInformation.php │ ├── ReportDownloads │ │ └── DownloadReport.php │ ├── ReportSubscriptions │ │ ├── CreateClassicStandardReportSubscription.php │ │ ├── CreateReportSubscription.php │ │ ├── DeleteSubscriptionOfReportNameByOrganization.php │ │ ├── GetAllSubscriptions.php │ │ └── GetSubscriptionForReportName.php │ ├── Reports │ │ ├── CreateAdhocReport.php │ │ ├── GetReportBasedOnReportId.php │ │ └── RetrieveAvailableReports.php │ ├── RetrievalDetails │ │ └── GetRetrievalDetails.php │ └── RetrievalSummaries │ │ └── GetRetrievalSummaries.php ├── RiskManagement │ ├── DecisionManager │ │ ├── AddDataToList.php │ │ ├── AddDuplicateInformation.php │ │ ├── BasicDMTransaction.php │ │ ├── DMWithBuyerInformation.php │ │ ├── DMWithDecisionProfileRejectResponse.php │ │ ├── DMWithDeviceInformation.php │ │ ├── DMWithMerchantDefinedInformation.php │ │ ├── DMWithScoreExceedsThresholdResponse.php │ │ ├── DMWithShippingInformation.php │ │ ├── DMWithTravelInformation.php │ │ ├── MarkAsSuspect.php │ │ └── RemoveFromHistory.php │ └── Verification │ │ ├── AddressMatchNotFound.php │ │ ├── ApartmentNumberMissingOrNotFound.php │ │ ├── CanadianBillingDetails.php │ │ ├── ComplianceStatusCompleted.php │ │ ├── CustomerMatchDeniedPartiesList.php │ │ ├── ExportComplianceInformationProvided.php │ │ ├── MultipleLineItems.php │ │ ├── MultipleSanctionLists.php │ │ ├── NoCompanyName.php │ │ ├── ShippingDetailsNotUSOrCanada.php │ │ └── VerboseRequestWithAllFields.php ├── SecureFileShare │ ├── DownloadFileWithFileIdentifier.php │ └── GetListOfFiles.php ├── TokenManagement │ ├── Customer │ │ ├── CreateCustomer.php │ │ ├── DeleteCustomer.php │ │ ├── RetrieveCustomer.php │ │ ├── UpdateCustomer.php │ │ ├── UpdateCustomersDefaultPaymentInstrument.php │ │ └── UpdateCustomersDefaultShippingAddress.php │ ├── CustomerPaymentInstrument │ │ ├── CreateCustomerDefaultPaymentInstrumentCard.php │ │ ├── CreateCustomerNonDefaultPaymentInstrumentCard.php │ │ ├── CreateCustomerPaymentInstrumentBankAccount.php │ │ ├── CreateCustomerPaymentInstrumentPinlessDebit.php │ │ ├── DeleteCustomerPaymentInstrument.php │ │ ├── ListPaymentInstrumentsForCustomer.php │ │ └── RetrieveCustomerPaymentInstrument.php │ ├── CustomerShippingAddress │ │ ├── CreateCustomerDefaultShippingAddress.php │ │ ├── CreateCustomerNonDefaultShippingAddress.php │ │ ├── DeleteCustomerShippingAddress.php │ │ ├── ListShippingAddressesForCustomer.php │ │ └── RetrieveCustomerShippingAddress.php │ ├── InstrumentIdentifier │ │ ├── CreateInstrumentIdentifierBankAccount.php │ │ ├── CreateInstrumentIdentifierCard.php │ │ ├── CreateInstrumentIdentifierCardEnrollForNetworkToken.php │ │ ├── DeleteInstrumentIdentifier.php │ │ ├── EnrollInstrumentIdentifierForNetworkTokenization.php │ │ ├── ListPaymentInstrumentsForInstrumentIdentifier.php │ │ ├── RetrieveInstrumentIdentifier.php │ │ └── UpdateInstrumentIdentifierPreviousTransactionId.php │ └── PaymentInstrument │ │ ├── CreatePaymentInstrumentBankAccount.php │ │ ├── CreatePaymentInstrumentCard.php │ │ ├── CreatePaymentInstrumentPinlessDebit.php │ │ ├── DeletePaymentInstrument.php │ │ ├── RetrievePaymentInstrument.php │ │ └── UpdatePaymentInstrument.php ├── TransactionBatches │ ├── GetIndividualBatchFile.php │ ├── GetListOfBatchFiles.php │ └── GetTransactionDetailsForGivenBatchId.php ├── TransactionDetails │ └── RetrieveTransaction.php ├── TransactionSearch │ ├── CreateSearchRequest.php │ └── GetSearchResults.php ├── UnifiedCheckout │ ├── GenerateCaptureContextForClickToPayDropInUI.php │ ├── GenerateUnifiedCheckoutCaptureContext.php │ └── GenerateUnifiedCheckoutCaptureContextPassingBillingShipping.php ├── UserManagement │ └── UserManagement │ │ └── GetUserInformationDeprecated.php ├── ValueAddedService │ ├── BasicTaxCalculationRequest.php │ ├── CommittedTaxCallRequest.php │ ├── CommittedTaxRefundCallRequest.php │ ├── TaxRefundRequest.php │ └── VoidCommittedTaxCall.php └── Webhooks │ ├── CreateNewWebhooks │ ├── CreateAlternativePaymentsNotificationWebhook.php │ ├── CreateDecisionManagerWebhook.php │ ├── CreateFraudManagementWebhook.php │ ├── CreateInvoicingWebhook.php │ ├── CreateOutageAndKeyExpirationNotificationWebhook.php │ ├── CreateRecurringBillingWebhook.php │ ├── CreateSecureAcceptanceWebhook.php │ ├── CreateTerminalManagementWebhook.php │ ├── CreateTokenManagementWebhook.php │ ├── CreateWebhookSymmetricKey.php │ ├── CreateWebhookUsingOAuthWithClientCredentials.php │ ├── CreateWebhookUsingOAuthWithJWT.php │ ├── FindProductsYouCanSubscribeTo.php │ └── StoreOAuthCredentials.php │ └── ManageWebhooks │ ├── CreateAsymmetricKey.php │ ├── DeleteWebhookSubscription.php │ ├── GetDetailsOnAllCreatedWebhooks.php │ ├── GetDetailsOnSingleWebhook.php │ ├── ReplayFailedTransactionsBySetStartAndEndTime.php │ ├── ReplayFailedTransactionsInLast24Hours.php │ ├── ReplaySpecificListOfTransactions.php │ └── UpdateWebhook.php ├── composer.json ├── lib └── SampleApiClient │ ├── Model │ ├── Request.php │ ├── V2creditsProcessingInformation.php │ ├── V2paymentsAggregatorInformation.php │ ├── V2paymentsAggregatorInformationSubMerchant.php │ ├── V2paymentsClientReferenceInformation.php │ ├── V2paymentsOrderInformation.php │ ├── V2paymentsOrderInformationAmountDetails.php │ ├── V2paymentsOrderInformationBillTo.php │ ├── V2paymentsPaymentInformation.php │ ├── V2paymentsPaymentInformationCard.php │ └── V2paymentsPaymentInformationCustomer.php │ ├── connection │ ├── connection.php │ ├── httpConnection.php │ └── jwtUrlConnection.php │ ├── controller │ ├── ApiException.php │ ├── ObjectSerializer.php │ └── apiController.php │ ├── masking │ └── maskingController.php │ ├── services │ ├── httpService.php │ └── jwtService.php │ └── sonar-project.properties ├── license.txt ├── sample_code_ignore_list.txt └── sample_code_runner.sh /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | Log 3 | .idea 4 | *.log 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.6 5 | - 7.0 6 | - 7.1 7 | - 8.0 8 | 9 | sudo: false 10 | 11 | before_script: 12 | - composer install --prefer-dist 13 | 14 | script: 15 | - bash sample_code_runner.sh 16 | # - cat output.log 17 | -------------------------------------------------------------------------------- /Resources/NetworkTokenCert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC4aEj4mUxdBAea 3 | YVtGmuJ1e4+QNj80t/K5kYP2xKc576t5V08Z643O6T+kNYoFRRBADhs0yPfBM0rK 4 | p+f8y6EiMTI/IjlB99OS16CXgprQKYoFAV8xUvUntbkOkCpyn157l05XLgnnIP+P 5 | Y1Y7/vlcq/ODpZPj6l4kKyeQwx3OQ8fQ1zsSPJ0SYhKu+M+oVGGH2ybEUaIBirWC 6 | v3XA/x32lz6AIyRF+IDqthBTTurWtwiYBWm6xJuTw8zZT+etm8bSNbRFnTNIkEtt 7 | DglA5qCeKQWKM6vgFO9+cnUaV7egT9rbS/DyxJXGP3yfJbWwaaWs5xRZHrlJUioB 8 | XSN/jOzVAgMBAAECggEAB++xCEXss+oa+6lp+LlsupqlPJMhGD88aoEZOVMQUV1/ 9 | tzqrNFXfZgLC0unc9UoaH2+b+yMVCpMPCna8dLQ8zJBqda4e4bhtOhoelravu/q1 10 | rm53LtO/qkRXYQmSUhmKwu3pmLXqBjD03rJrQSzBhZv+4HENUtdA0vSqgL/s9fYB 11 | BQHnq1wYPSHGonMdQCOBh2JeLqoJVnrU3tdrfu9gppS0a/olKN5s5+5jO4tf3wWH 12 | DeDUDwIN7+vw/pzYOzTTJOs/hWIbxzr4wxYhG2RRBbKwyrbBRwS7GMSQfPA+BuYW 13 | ZF9fPUP7L8SMwME/cIQ4ZKQVyun+5QDQvDSWxG7hIQKBgQDwSvIyRjuTlVP9zkWR 14 | ihyYW6I5BQivnd5kjEHFWYoH/XXwEJTk/lB8hFVJx02S0iBxxQW+3AUF52ejKWVq 15 | 7AI6khhooBcc0iImh0Dm2qy912N0SLn29lfz8Lgb47lvCOvvgUUZqZDuugYPhCaU 16 | zbRBEaXXXzZq64JvI0GNDjM2hQKBgQDEdidphv/ZItWOhsaaRBav56jVsRscXcIR 17 | Xe+Fnz5NTDE8OJeJwCNLkmrV5GZTlHVc1aQ6eUOPgOUiJhr4MNN4CIf+fDbhpw6d 18 | m8sHfGEmKt18Ei7fXaSlvICNz5SHkZ3M52nDfKUcp8W+2zB8iIUdXokhHJk4/drT 19 | sI9nsoF2EQKBgAGmYhdaSBpxUgxSGEQxkJSzPF/r2u1pxhcmp2T1gm8fnGmzk3In 20 | FOJl/jfteGjjrHlbgviWhipONnX2WM3tJO7GBgjh4IbAIp/lGdr78We0TOiFf1Fk 21 | y6HPK1R1sdZDV2tjldfhRC9/c38zxxgKeYxg1KSv8K23REQDF/Yh/NQJAoGBAMLq 22 | Ks4S5zGJ0vEWHGKfXRbmsuZYUXqCNvG+Dc63oDtWdZ620voTC7GFscNGWJNhvlL9 23 | j3OILhRpIGwR/D3zS0tSw4IjwNt+QAz0raleqJAShS38aE6p/JmGfNC1ezpJqZLK 24 | oW8W8kWM2q8xjlhvpgnuagTU99vIWFwgVxbdzn3RAoGBANmfExNfl/WhPby8BRCU 25 | OAt39sWZbm5j6USdUcnENs7XQ6vRLLFbPn1oUJiw8YSFn0QSmZXAHYPmLBoSKo9N 26 | xXrEdoDF22Exktb9/Htq/Iw0V+2xmKss7OCYOZS8erNPQ9BgqMmQC7faoEgDiGOS 27 | MMtHbJvYmrSvZgBF1E3snHE+ 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /Resources/TRRReport.json: -------------------------------------------------------------------------------- 1 | { "startDay":"23", 2 | "timeZone":"America/Chicago", 3 | "reportDefinitionName":"TransactionRequestClass", 4 | "startTime":"1100", 5 | "reportFrequency":"DAILY", 6 | "ReportName":"TRRReport", 7 | "reportFormat":"csv", 8 | "orgId":"testrest", 9 | "reportType":"detail", 10 | "reportFields": ["Request.RequestID","Request.TransactionDate","Request.MerchantReferenceNumber","Request.MerchantID"] 11 | } -------------------------------------------------------------------------------- /Resources/authRequest.json: -------------------------------------------------------------------------------- 1 | { 2 | "clientReferenceInformation": { 3 | "code": "TC50171_3" 4 | }, 5 | "processingInformation": { 6 | "commerceIndicator": "internet" 7 | }, 8 | "aggregatorInformation": { 9 | "subMerchant": { 10 | "cardAcceptorID": "1234567890", 11 | "country": "US", 12 | "phoneNumber": "650-432-0000", 13 | "address1": "900 Metro Center", 14 | "postalCode": "94404-2775", 15 | "locality": "Foster City", 16 | "name": "Visa Inc", 17 | "administrativeArea": "CA", 18 | "region": "PEN", 19 | "email": "test@cybs.com" 20 | }, 21 | "name": "V-Internatio", 22 | "aggregatorID": "123456789" 23 | }, 24 | "orderInformation": { 25 | "billTo": { 26 | "country": "US", 27 | "lastName": "VDP", 28 | "address2": "Address 2", 29 | "address1": "201 S. Division St.", 30 | "postalCode": "48104-2201", 31 | "locality": "Ann Arbor", 32 | "administrativeArea": "MI", 33 | "firstName": "RTS", 34 | "phoneNumber": "999999999", 35 | "district": "MI", 36 | "buildingNumber": "123", 37 | "company": "Visa", 38 | "email": "test@cybs.com" 39 | }, 40 | "amountDetails": { 41 | "totalAmount": "102.21", 42 | "currency": "USD" 43 | } 44 | }, 45 | "paymentInformation": { 46 | "card": { 47 | "expirationYear": "2031", 48 | "number": "5555555555554444", 49 | "securityCode": "123", 50 | "expirationMonth": "12", 51 | "type": "002" 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Resources/autoload.php: -------------------------------------------------------------------------------- 1 | "C06977C0EDC0E985E053AF598E0A3326" 10 | ]; 11 | $includedTokens[0] = new CyberSource\Model\Accountupdaterv1batchesIncludedTokens($includedTokens_0); 12 | 13 | $includedTokens_1 = [ 14 | "id" => "C069A534044F6140E053AF598E0AD492" 15 | ]; 16 | $includedTokens[1] = new CyberSource\Model\Accountupdaterv1batchesIncludedTokens($includedTokens_1); 17 | 18 | $includedArr = [ 19 | "tokens" => $includedTokens 20 | ]; 21 | $included = new CyberSource\Model\Accountupdaterv1batchesIncluded($includedArr); 22 | 23 | $requestObjArr = [ 24 | "type" => "amexRegistration", 25 | "included" => $included, 26 | "merchantReference" => "TC50171_3", 27 | "notificationEmail" => "test@cybs.com" 28 | ]; 29 | $requestObj = new CyberSource\Model\Body($requestObjArr); 30 | 31 | 32 | $commonElement = new CyberSource\ExternalConfiguration(); 33 | $config = $commonElement->ConnectionHost(); 34 | $merchantConfig = $commonElement->merchantConfigObject(); 35 | 36 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 37 | $api_instance = new CyberSource\Api\BatchesApi($api_client); 38 | 39 | try { 40 | $apiResponse = $api_instance->postBatch($requestObj); 41 | print_r(PHP_EOL); 42 | print_r($apiResponse); 43 | WriteLogAudit($apiResponse[1]); 44 | 45 | return $apiResponse; 46 | } catch (Cybersource\ApiException $e) { 47 | print_r($e->getResponseBody()); 48 | print_r($e->getMessage()); 49 | $errorCode = $e->getCode(); 50 | WriteLogAudit($errorCode); 51 | } 52 | } 53 | 54 | if (!function_exists('WriteLogAudit')){ 55 | function WriteLogAudit($status){ 56 | $sampleCode = basename(__FILE__, '.php'); 57 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 58 | } 59 | } 60 | 61 | if(!defined('DO_NOT_RUN_SAMPLES')) { 62 | echo "\nAmexRegistrationCustomerTokenBatch Sample Code is Running..." . PHP_EOL; 63 | AmexRegistrationCustomerTokenBatch(); 64 | } 65 | ?> 66 | -------------------------------------------------------------------------------- /Samples/AccountUpdater/ListBatches.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 10 | $merchantConfig = $commonElement->merchantConfigObject(); 11 | 12 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 13 | $api_instance = new CyberSource\Api\BatchesApi($api_client); 14 | 15 | $offset = 0; 16 | $limit = 10; 17 | $fromDate = "20230101T123000Z"; 18 | $toDate = "20230410T123000Z"; 19 | 20 | try { 21 | $apiResponse = $api_instance->getBatchesList($offset, $limit, $fromDate, $toDate); 22 | print_r(PHP_EOL); 23 | print_r($apiResponse); 24 | WriteLogAudit($apiResponse[1]); 25 | 26 | return $apiResponse; 27 | } catch (Cybersource\ApiException $e) { 28 | print_r($e->getResponseBody()); 29 | print_r($e->getMessage()); 30 | $errorCode = $e->getCode(); 31 | WriteLogAudit($errorCode); 32 | } 33 | } 34 | 35 | if (!function_exists('WriteLogAudit')){ 36 | function WriteLogAudit($status){ 37 | $sampleCode = basename(__FILE__, '.php'); 38 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 39 | } 40 | } 41 | 42 | if(!defined('DO_NOT_RUN_SAMPLES')) { 43 | echo "\nListBatches Sample Code is Running..." . PHP_EOL; 44 | ListBatches(); 45 | } 46 | ?> 47 | -------------------------------------------------------------------------------- /Samples/AccountUpdater/OneOffVisaMasterCardCustomerTokenBatch.php: -------------------------------------------------------------------------------- 1 | "C064DE56200B0DB0E053AF598E0A52AA" 10 | ]; 11 | $includedTokens[0] = new CyberSource\Model\Accountupdaterv1batchesIncludedTokens($includedTokens_0); 12 | 13 | $includedTokens_1 = [ 14 | "id" => "C064DE56213D0DB0E053AF598E0A52AA" 15 | ]; 16 | $includedTokens[1] = new CyberSource\Model\Accountupdaterv1batchesIncludedTokens($includedTokens_1); 17 | 18 | $includedArr = [ 19 | "tokens" => $includedTokens 20 | ]; 21 | $included = new CyberSource\Model\Accountupdaterv1batchesIncluded($includedArr); 22 | 23 | $requestObjArr = [ 24 | "type" => "oneOff", 25 | "included" => $included, 26 | "merchantReference" => "TC50171_3", 27 | "notificationEmail" => "test@cybs.com" 28 | ]; 29 | $requestObj = new CyberSource\Model\Body($requestObjArr); 30 | 31 | 32 | $commonElement = new CyberSource\ExternalConfiguration(); 33 | $config = $commonElement->ConnectionHost(); 34 | $merchantConfig = $commonElement->merchantConfigObject(); 35 | 36 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 37 | $api_instance = new CyberSource\Api\BatchesApi($api_client); 38 | 39 | try { 40 | $apiResponse = $api_instance->postBatch($requestObj); 41 | print_r(PHP_EOL); 42 | print_r($apiResponse); 43 | WriteLogAudit($apiResponse[1]); 44 | 45 | return $apiResponse; 46 | } catch (Cybersource\ApiException $e) { 47 | print_r($e->getResponseBody()); 48 | print_r($e->getMessage()); 49 | $errorCode = $e->getCode(); 50 | WriteLogAudit($errorCode); 51 | } 52 | } 53 | 54 | if (!function_exists('WriteLogAudit')){ 55 | function WriteLogAudit($status){ 56 | $sampleCode = basename(__FILE__, '.php'); 57 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 58 | } 59 | } 60 | 61 | if(!defined('DO_NOT_RUN_SAMPLES')) { 62 | echo "\nOneOffVisaMasterCardCustomerTokenBatch Sample Code is Running..." . PHP_EOL; 63 | OneOffVisaMasterCardCustomerTokenBatch(); 64 | } 65 | ?> 66 | -------------------------------------------------------------------------------- /Samples/AccountUpdater/RetrieveBatchReport.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 10 | $merchantConfig = $commonElement->merchantConfigObject(); 11 | 12 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 13 | $api_instance = new CyberSource\Api\BatchesApi($api_client); 14 | 15 | $batchId = "16188390061150001062041064"; 16 | 17 | try { 18 | $apiResponse = $api_instance->getBatchReport($batchId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | WriteLogAudit($apiResponse[1]); 22 | 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')) { 40 | echo "\nRetrieveBatchReport Sample Code is Running..." . PHP_EOL; 41 | RetrieveBatchReport(); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /Samples/AccountUpdater/RetrieveBatchStatus.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 10 | $merchantConfig = $commonElement->merchantConfigObject(); 11 | 12 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 13 | $api_instance = new CyberSource\Api\BatchesApi($api_client); 14 | 15 | $batchId = "16188390061150001062041064"; 16 | try { 17 | $apiResponse = $api_instance->getBatchStatus($batchId); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | WriteLogAudit($apiResponse[1]); 21 | 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')) { 39 | echo "\nRetrieveBatchStatus Sample Code is Running..." . PHP_EOL; 40 | RetrieveBatchStatus(); 41 | } 42 | ?> 43 | -------------------------------------------------------------------------------- /Samples/Authentication/deleteMethod.php: -------------------------------------------------------------------------------- 1 | merchantConfigObject(); 18 | 19 | $requestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; 20 | 21 | $api_response = list($response, $statusCode, $httpHeader) = null; 22 | try { 23 | $api_instance = new CybSource\ApiController(); 24 | $api_response = $api_instance->apiController(GlobalParameter::DELETE, "", $requestTarget, $merchantConfigObj); 25 | 26 | if (is_array($api_response)) { 27 | print_r($api_response); 28 | WriteLogAudit($api_response[1]); 29 | } 30 | 31 | } 32 | catch (Exception $e) { 33 | $error_code = (explode(" ", $e->getresponseHeaders()[0]))[1]; 34 | if ($error_code == 404) { 35 | WriteLogAudit(200); 36 | } else { 37 | WriteLogAudit($error_code); 38 | } 39 | print_r($e->getresponseBody()); 40 | } 41 | } 42 | } 43 | 44 | if (!function_exists('WriteLogAudit')){ 45 | function WriteLogAudit($status){ 46 | $sampleCode = basename(__FILE__, '.php'); 47 | print_r("\n[Sample Code Testing] [$sampleCode] $status\n"); 48 | } 49 | } 50 | 51 | $obj = new DeleteMethod(); 52 | $obj->deleteFromServerMethod(); 53 | 54 | ?> -------------------------------------------------------------------------------- /Samples/Authentication/getMethod.php: -------------------------------------------------------------------------------- 1 | merchantConfigObject(); 19 | 20 | $requestTarget = "/pts/v2/payments/" . $paymentID; 21 | 22 | $api_response = list($response, $statusCode, $httpHeader) = null; 23 | try { 24 | $api_instance = new CybSource\ApiController(); 25 | $api_response = $api_instance->apiController(GlobalParameter::GET, "", $requestTarget, $merchantConfigObj); 26 | 27 | if (is_array($api_response)) { 28 | print_r($api_response); 29 | WriteLogAudit($api_response[1]); 30 | } 31 | } 32 | catch (Exception $e) { 33 | WriteLogAudit((explode(" ", $e->getresponseHeaders()[0]))[1]); 34 | print_r($e->getresponseBody()); 35 | } 36 | } 37 | } 38 | 39 | if (!function_exists('WriteLogAudit')){ 40 | function WriteLogAudit($status){ 41 | $sampleCode = basename(__FILE__, '.php'); 42 | print_r("\n[Sample Code Testing] [$sampleCode] $status\n"); 43 | } 44 | } 45 | 46 | $obj = new GetMethod(); 47 | $obj->getTransactionMethod(); 48 | 49 | ?> -------------------------------------------------------------------------------- /Samples/Authentication/postMethod.php: -------------------------------------------------------------------------------- 1 | merchantConfigObject(); 14 | 15 | $requestJsonPath = __DIR__ . DIRECTORY_SEPARATOR . '../../Resources/authRequest.json'; 16 | 17 | $payload = new CyberSource\Authentication\PayloadDigest\PayloadDigest(); 18 | $payloadData = $payload->getPayloadDigest($requestJsonPath, $merchantConfigObj); 19 | 20 | $requestTarget = "/pts/v2/payments"; 21 | 22 | $api_response = list($response, $statusCode, $httpHeader) = null; 23 | try { 24 | $api_instance = new CybSource\ApiController(); 25 | $api_response = $api_instance->apiController("POST", $payloadData, $requestTarget, $merchantConfigObj); 26 | 27 | if (is_array($api_response)) { 28 | print_r($api_response); 29 | WriteLogAudit($api_response[1]); 30 | } 31 | } 32 | catch (Exception $e) { 33 | WriteLogAudit((explode(" ", $e->getresponseHeaders()[0]))[1]); 34 | print_r($e->getresponseBody()); 35 | } 36 | } 37 | } 38 | 39 | if (!function_exists('WriteLogAudit')){ 40 | function WriteLogAudit($status){ 41 | $sampleCode = basename(__FILE__, '.php'); 42 | print_r("\n[Sample Code Testing] [$sampleCode] $status\n"); 43 | } 44 | } 45 | 46 | $obj = new PostMethod(); 47 | $obj->postToServerMethod(); 48 | 49 | ?> -------------------------------------------------------------------------------- /Samples/Authentication/putGenerateHeaders.php: -------------------------------------------------------------------------------- 1 | merchantConfigObject(); 14 | 15 | $requestJsonPath = __DIR__ . DIRECTORY_SEPARATOR . '../../Resources/authRequest.json'; 16 | 17 | $payload = new CyberSource\Authentication\PayloadDigest\PayloadDigest(); 18 | $payloadData = $payload->getPayloadDigest($requestJsonPath, $merchantConfigObj); 19 | 20 | $requestTarget = "/pts/v2/payments" . $paymentId; 21 | 22 | $api_response = list($response, $statusCode, $httpHeader) = null; 23 | try { 24 | $auth = new CyberSource\Authentication\Core\Authentication(); 25 | $authResponse = $auth->generateToken($requestTarget, $payloadData, "GET", $merchantConfigObj); 26 | 27 | if ($merchantConfigObj->getLogConfiguration()->getEnableLogging()) { 28 | error_log( "[DEBUG] HTTP Response body ~BEGIN~" . PHP_EOL . "Request Target GET: " . $requestTarget . PHP_EOL . "~END~" . PHP_EOL, 29 | 3, 30 | $merchantConfigObj->getLogConfiguration()->getDebugLogFile() 31 | ); 32 | } 33 | 34 | print_r($authResponse); 35 | WriteLogAudit(200); 36 | } 37 | catch (Exception $e) { 38 | print_r($e->getresponseBody()->details[0]); 39 | WriteLogAudit(400); 40 | } 41 | } 42 | } 43 | 44 | $paymentId = "5408386919326811103004"; 45 | 46 | if (!function_exists('WriteLogAudit')){ 47 | function WriteLogAudit($status){ 48 | $sampleCode = basename(__FILE__, '.php'); 49 | print_r("\n[Sample Code Testing] [$sampleCode] $status\n"); 50 | } 51 | } 52 | 53 | $obj = new PutGeneratorHeader(); 54 | $obj->putMethod($paymentId); 55 | 56 | ?> -------------------------------------------------------------------------------- /Samples/Authentication/putMethod.php: -------------------------------------------------------------------------------- 1 | merchantConfigObject(); 17 | 18 | $requestJsonPath = __DIR__ . DIRECTORY_SEPARATOR . '../../Resources/TRRReport.json'; 19 | 20 | $payload = new CyberSource\Authentication\PayloadDigest\PayloadDigest(); 21 | $payloadData = $payload->getPayloadDigest($requestJsonPath, $merchantConfigObj); 22 | 23 | $requestTarget = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest"; 24 | 25 | $api_response = list($response, $statusCode, $httpHeader) = null; 26 | try { 27 | $api_instance = new CybSource\ApiController(); 28 | $api_response = $api_instance->apiController(GlobalParameter::PUT, $payloadData, $requestTarget, $merchantConfigObj); 29 | 30 | if (is_array($api_response)) { 31 | print_r($api_response); 32 | WriteLogAudit($api_response[1]); 33 | } 34 | } 35 | catch (Exception $e) { 36 | WriteLogAudit((explode(" ", $e->getresponseHeaders()[0]))[1]); 37 | print_r($e->getresponseBody()); 38 | } 39 | } 40 | } 41 | 42 | if (!function_exists('WriteLogAudit')){ 43 | function WriteLogAudit($status){ 44 | $sampleCode = basename(__FILE__, '.php'); 45 | print_r("\n[Sample Code Testing] [$sampleCode] $status\n"); 46 | } 47 | } 48 | 49 | $obj = new PutMethod(); 50 | $obj->putToServerMethod(); 51 | 52 | ?> -------------------------------------------------------------------------------- /Samples/BinLookup/BINLookupWithCard.php: -------------------------------------------------------------------------------- 1 | "4111111111111111" 13 | ]; 14 | $paymentInformationCard = new CyberSource\Model\Binv1binlookupPaymentInformationCard($paymentInformationCardArr); 15 | 16 | $paymentInformationArr = [ 17 | "card" => $paymentInformationCard 18 | ]; 19 | $paymentInformation = new CyberSource\Model\Binv1binlookupPaymentInformation($paymentInformationArr); 20 | 21 | $requestObjArr = [ 22 | "clientReferenceInformation" => $clientReferenceInformation, 23 | "paymentInformation" => $paymentInformation 24 | ]; 25 | $requestObj = new CyberSource\Model\CreateBinLookupRequest($requestObjArr); 26 | 27 | 28 | $commonElement = new CyberSource\ExternalConfiguration(); 29 | $config = $commonElement->ConnectionHost(); 30 | $merchantConfig = $commonElement->merchantConfigObject(); 31 | 32 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 33 | $api_instance = new CyberSource\Api\BinLookupApi($api_client); 34 | 35 | try { 36 | $apiResponse = $api_instance->getAccountInfo($requestObj); 37 | print_r(PHP_EOL); 38 | print_r($apiResponse); 39 | WriteLogAudit($apiResponse[1]); 40 | 41 | return $apiResponse; 42 | } catch (Cybersource\ApiException $e) { 43 | print_r($e->getResponseBody()); 44 | print_r($e->getMessage()); 45 | $errorCode = $e->getCode(); 46 | WriteLogAudit($errorCode); 47 | } 48 | } 49 | 50 | if (!function_exists('WriteLogAudit')){ 51 | function WriteLogAudit($status){ 52 | $sampleCode = basename(__FILE__, '.php'); 53 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 54 | } 55 | } 56 | 57 | if(!defined('DO_NOT_RUN_SAMPLES')) { 58 | echo "\nBINLookupWithCard Sample Code is Running..." . PHP_EOL; 59 | BINLookupWithCard(); 60 | } 61 | ?> -------------------------------------------------------------------------------- /Samples/BinLookup/BINLookupWithHealthcareCard.php: -------------------------------------------------------------------------------- 1 | "4288900100000" 9 | ]; 10 | $paymentInformationCard = new CyberSource\Model\Binv1binlookupPaymentInformationCard($paymentInformationCardArr); 11 | 12 | $paymentInformationArr = [ 13 | "card" => $paymentInformationCard 14 | ]; 15 | $paymentInformation = new CyberSource\Model\Binv1binlookupPaymentInformation($paymentInformationArr); 16 | 17 | $requestObjArr = [ 18 | "paymentInformation" => $paymentInformation 19 | ]; 20 | $requestObj = new CyberSource\Model\CreateBinLookupRequest($requestObjArr); 21 | 22 | 23 | $commonElement = new CyberSource\ExternalConfiguration(); 24 | $config = $commonElement->ConnectionHost(); 25 | $merchantConfig = $commonElement->merchantConfigObject(); 26 | 27 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 28 | $api_instance = new CyberSource\Api\BinLookupApi($api_client); 29 | 30 | try { 31 | $apiResponse = $api_instance->getAccountInfo($requestObj); 32 | print_r(PHP_EOL); 33 | print_r($apiResponse); 34 | WriteLogAudit($apiResponse[1]); 35 | 36 | return $apiResponse; 37 | } catch (Cybersource\ApiException $e) { 38 | print_r($e->getResponseBody()); 39 | print_r($e->getMessage()); 40 | $errorCode = $e->getCode(); 41 | WriteLogAudit($errorCode); 42 | } 43 | } 44 | 45 | if (!function_exists('WriteLogAudit')){ 46 | function WriteLogAudit($status){ 47 | $sampleCode = basename(__FILE__, '.php'); 48 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 49 | } 50 | } 51 | 52 | if(!defined('DO_NOT_RUN_SAMPLES')) { 53 | echo "\nBINLookupWithHealthcareCard Sample Code is Running..." . PHP_EOL; 54 | BINLookupWithHealthcareCard(); 55 | } 56 | ?> -------------------------------------------------------------------------------- /Samples/BinLookup/BINLookupWithNetworkToken.php: -------------------------------------------------------------------------------- 1 | "4895370016313691" 9 | ]; 10 | $paymentInformationCard = new CyberSource\Model\Binv1binlookupPaymentInformationCard($paymentInformationCardArr); 11 | 12 | $paymentInformationArr = [ 13 | "card" => $paymentInformationCard 14 | ]; 15 | $paymentInformation = new CyberSource\Model\Binv1binlookupPaymentInformation($paymentInformationArr); 16 | 17 | $requestObjArr = [ 18 | "paymentInformation" => $paymentInformation 19 | ]; 20 | $requestObj = new CyberSource\Model\CreateBinLookupRequest($requestObjArr); 21 | 22 | 23 | $commonElement = new CyberSource\ExternalConfiguration(); 24 | $config = $commonElement->ConnectionHost(); 25 | $merchantConfig = $commonElement->merchantConfigObject(); 26 | 27 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 28 | $api_instance = new CyberSource\Api\BinLookupApi($api_client); 29 | 30 | try { 31 | $apiResponse = $api_instance->getAccountInfo($requestObj); 32 | print_r(PHP_EOL); 33 | print_r($apiResponse); 34 | WriteLogAudit($apiResponse[1]); 35 | 36 | return $apiResponse; 37 | } catch (Cybersource\ApiException $e) { 38 | print_r($e->getResponseBody()); 39 | print_r($e->getMessage()); 40 | $errorCode = $e->getCode(); 41 | WriteLogAudit($errorCode); 42 | } 43 | } 44 | 45 | if (!function_exists('WriteLogAudit')){ 46 | function WriteLogAudit($status){ 47 | $sampleCode = basename(__FILE__, '.php'); 48 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 49 | } 50 | } 51 | 52 | if(!defined('DO_NOT_RUN_SAMPLES')) { 53 | echo "\nBINLookupWithNetworkToken Sample Code is Running..." . PHP_EOL; 54 | BINLookupWithNetworkToken(); 55 | } 56 | ?> -------------------------------------------------------------------------------- /Samples/BinLookup/BINLookupWithTMSCustomerID.php: -------------------------------------------------------------------------------- 1 | "E5426CFDE77F7390E053A2598D0A925D" 9 | ]; 10 | $paymentInformationCustomer = new CyberSource\Model\GetAllSubscriptionsResponsePaymentInformationCustomer($paymentInformationCustomerArr); 11 | 12 | $paymentInformationArr = [ 13 | "customer" => $paymentInformationCustomer 14 | ]; 15 | $paymentInformation = new CyberSource\Model\Binv1binlookupPaymentInformation($paymentInformationArr); 16 | 17 | $requestObjArr = [ 18 | "paymentInformation" => $paymentInformation 19 | ]; 20 | $requestObj = new CyberSource\Model\CreateBinLookupRequest($requestObjArr); 21 | 22 | 23 | $commonElement = new CyberSource\ExternalConfiguration(); 24 | $config = $commonElement->ConnectionHost(); 25 | $merchantConfig = $commonElement->merchantConfigObject(); 26 | 27 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 28 | $api_instance = new CyberSource\Api\BinLookupApi($api_client); 29 | 30 | try { 31 | $apiResponse = $api_instance->getAccountInfo($requestObj); 32 | print_r(PHP_EOL); 33 | print_r($apiResponse); 34 | WriteLogAudit($apiResponse[1]); 35 | 36 | return $apiResponse; 37 | } catch (Cybersource\ApiException $e) { 38 | print_r($e->getResponseBody()); 39 | print_r($e->getMessage()); 40 | $errorCode = $e->getCode(); 41 | WriteLogAudit($errorCode); 42 | } 43 | } 44 | 45 | if (!function_exists('WriteLogAudit')){ 46 | function WriteLogAudit($status){ 47 | $sampleCode = basename(__FILE__, '.php'); 48 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 49 | } 50 | } 51 | 52 | if(!defined('DO_NOT_RUN_SAMPLES')) { 53 | echo "\nBINLookupWithTMSCustomerID Sample Code is Running..." . PHP_EOL; 54 | BINLookupWithTMSCustomerID(); 55 | } 56 | ?> -------------------------------------------------------------------------------- /Samples/BinLookup/BINLookupWithTMSInstrumentIdentifier.php: -------------------------------------------------------------------------------- 1 | "7010000000016241111" 9 | ]; 10 | $paymentInformationInstrumentIdentifier = new CyberSource\Model\Ptsv2paymentsPaymentInformationInstrumentIdentifier($paymentInformationInstrumentIdentifierArr); 11 | 12 | $paymentInformationArr = [ 13 | "instrumentIdentifier" => $paymentInformationInstrumentIdentifier 14 | ]; 15 | $paymentInformation = new CyberSource\Model\Binv1binlookupPaymentInformation($paymentInformationArr); 16 | 17 | $requestObjArr = [ 18 | "paymentInformation" => $paymentInformation 19 | ]; 20 | $requestObj = new CyberSource\Model\CreateBinLookupRequest($requestObjArr); 21 | 22 | 23 | $commonElement = new CyberSource\ExternalConfiguration(); 24 | $config = $commonElement->ConnectionHost(); 25 | $merchantConfig = $commonElement->merchantConfigObject(); 26 | 27 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 28 | $api_instance = new CyberSource\Api\BinLookupApi($api_client); 29 | 30 | try { 31 | $apiResponse = $api_instance->getAccountInfo($requestObj); 32 | print_r(PHP_EOL); 33 | print_r($apiResponse); 34 | WriteLogAudit($apiResponse[1]); 35 | 36 | return $apiResponse; 37 | } catch (Cybersource\ApiException $e) { 38 | print_r($e->getResponseBody()); 39 | print_r($e->getMessage()); 40 | $errorCode = $e->getCode(); 41 | WriteLogAudit($errorCode); 42 | } 43 | } 44 | 45 | if (!function_exists('WriteLogAudit')){ 46 | function WriteLogAudit($status){ 47 | $sampleCode = basename(__FILE__, '.php'); 48 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 49 | } 50 | } 51 | 52 | if(!defined('DO_NOT_RUN_SAMPLES')) { 53 | echo "\nBINLookupWithTMSInstrumentIdentifier Sample Code is Running..." . PHP_EOL; 54 | BINLookupWithTMSInstrumentIdentifier(); 55 | } 56 | ?> -------------------------------------------------------------------------------- /Samples/BinLookup/BINLookupWithTMSJtiTransientToken.php: -------------------------------------------------------------------------------- 1 | "1E0WC1GO87JG1BDP0CQ8SCR1TTK86U9N98H3WH8IFM9MVEWTIYFI62F4941E7A92" 9 | ]; 10 | $tokenInformation = new CyberSource\Model\Binv1binlookupTokenInformation($tokenInformationArr); 11 | 12 | $requestObjArr = [ 13 | "tokenInformation" => $tokenInformation 14 | ]; 15 | $requestObj = new CyberSource\Model\CreateBinLookupRequest($requestObjArr); 16 | 17 | 18 | $commonElement = new CyberSource\ExternalConfiguration(); 19 | $config = $commonElement->ConnectionHost(); 20 | $merchantConfig = $commonElement->merchantConfigObject(); 21 | 22 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 23 | $api_instance = new CyberSource\Api\BinLookupApi($api_client); 24 | 25 | try { 26 | $apiResponse = $api_instance->getAccountInfo($requestObj); 27 | print_r(PHP_EOL); 28 | print_r($apiResponse); 29 | WriteLogAudit($apiResponse[1]); 30 | 31 | return $apiResponse; 32 | } catch (Cybersource\ApiException $e) { 33 | print_r($e->getResponseBody()); 34 | print_r($e->getMessage()); 35 | $errorCode = $e->getCode(); 36 | WriteLogAudit($errorCode); 37 | } 38 | } 39 | 40 | if (!function_exists('WriteLogAudit')){ 41 | function WriteLogAudit($status){ 42 | $sampleCode = basename(__FILE__, '.php'); 43 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 44 | } 45 | } 46 | 47 | if(!defined('DO_NOT_RUN_SAMPLES')) { 48 | echo "\nBINLookupWithTMSJtiTransientToken Sample Code is Running..." . PHP_EOL; 49 | BINLookupWithTMSJtiTransientToken(); 50 | } 51 | ?> -------------------------------------------------------------------------------- /Samples/BinLookup/BINLookupWithTMSPaymentInstrument.php: -------------------------------------------------------------------------------- 1 | "E5427539180789D0E053A2598D0AF053" 9 | ]; 10 | $paymentInformationPaymentInstrument = new CyberSource\Model\Ptsv2paymentsPaymentInformationPaymentInstrument($paymentInformationPaymentInstrumentArr); 11 | 12 | $paymentInformationArr = [ 13 | "paymentInstrument" => $paymentInformationPaymentInstrument 14 | ]; 15 | $paymentInformation = new CyberSource\Model\Binv1binlookupPaymentInformation($paymentInformationArr); 16 | 17 | $requestObjArr = [ 18 | "paymentInformation" => $paymentInformation 19 | ]; 20 | $requestObj = new CyberSource\Model\CreateBinLookupRequest($requestObjArr); 21 | 22 | 23 | $commonElement = new CyberSource\ExternalConfiguration(); 24 | $config = $commonElement->ConnectionHost(); 25 | $merchantConfig = $commonElement->merchantConfigObject(); 26 | 27 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 28 | $api_instance = new CyberSource\Api\BinLookupApi($api_client); 29 | 30 | try { 31 | $apiResponse = $api_instance->getAccountInfo($requestObj); 32 | print_r(PHP_EOL); 33 | print_r($apiResponse); 34 | WriteLogAudit($apiResponse[1]); 35 | 36 | return $apiResponse; 37 | } catch (Cybersource\ApiException $e) { 38 | print_r($e->getResponseBody()); 39 | print_r($e->getMessage()); 40 | $errorCode = $e->getCode(); 41 | WriteLogAudit($errorCode); 42 | } 43 | } 44 | 45 | if (!function_exists('WriteLogAudit')){ 46 | function WriteLogAudit($status){ 47 | $sampleCode = basename(__FILE__, '.php'); 48 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 49 | } 50 | } 51 | 52 | if(!defined('DO_NOT_RUN_SAMPLES')) { 53 | echo "\nBINLookupWithTMSPaymentInstrument Sample Code is Running..." . PHP_EOL; 54 | BINLookupWithTMSPaymentInstrument(); 55 | } 56 | ?> -------------------------------------------------------------------------------- /Samples/FlexMicroform/GenerateCaptureContextAcceptCard.php: -------------------------------------------------------------------------------- 1 | "v2", 29 | "targetOrigins" => $targetOrigins, 30 | "allowedCardNetworks" => $allowedCardNetworks, 31 | "allowedPaymentTypes" => $allowedPaymentTypes 32 | 33 | ]; 34 | $requestObj = new CyberSource\Model\GenerateCaptureContextRequest($requestObjArr); 35 | 36 | 37 | $commonElement = new CyberSource\ExternalConfiguration(); 38 | $config = $commonElement->ConnectionHost(); 39 | $merchantConfig = $commonElement->merchantConfigObject(); 40 | 41 | $apiClient = new CyberSource\ApiClient($config, $merchantConfig); 42 | $apiInstance = new CyberSource\Api\MicroformIntegrationApi($apiClient); 43 | 44 | try { 45 | $apiResponse = $apiInstance->generateCaptureContext($requestObj); 46 | print_r(PHP_EOL); 47 | print_r($apiResponse); 48 | 49 | return $apiResponse; 50 | } catch (Cybersource\ApiException $e) { 51 | print_r($e->getResponseBody()); 52 | print_r($e->getMessage()); 53 | } 54 | } 55 | 56 | if (!defined('DO_NOT_RUN_SAMPLES')) { 57 | echo "\GenerateCaptureContextAcceptCard Sample Code is Running..." . PHP_EOL; 58 | GenerateCaptureContextAcceptCard(); 59 | } 60 | ?> -------------------------------------------------------------------------------- /Samples/FlexMicroform/GenerateCaptureContextAcceptCheck.php: -------------------------------------------------------------------------------- 1 | "v2", 13 | "targetOrigins" => $targetOrigins, 14 | "allowedPaymentTypes" => $allowedPaymentTypes 15 | 16 | ]; 17 | $requestObj = new CyberSource\Model\GenerateCaptureContextRequest($requestObjArr); 18 | 19 | 20 | 21 | $commonElement = new CyberSource\ExternalConfiguration(); 22 | $config = $commonElement->ConnectionHost(); 23 | $merchantConfig = $commonElement->merchantConfigObject(); 24 | 25 | $apiClient = new CyberSource\ApiClient($config, $merchantConfig); 26 | $apiInstance = new CyberSource\Api\MicroformIntegrationApi($apiClient); 27 | 28 | try { 29 | $apiResponse = $apiInstance->generateCaptureContext($requestObj); 30 | print_r(PHP_EOL); 31 | print_r($apiResponse); 32 | 33 | return $apiResponse; 34 | } catch (Cybersource\ApiException $e) { 35 | print_r($e->getResponseBody()); 36 | print_r($e->getMessage()); 37 | } 38 | } 39 | 40 | if (!defined('DO_NOT_RUN_SAMPLES')) { 41 | echo "\GenerateCaptureContextAcceptCheck Sample Code is Running..." . PHP_EOL; 42 | GenerateCaptureContextAcceptCheck(); 43 | } 44 | ?> -------------------------------------------------------------------------------- /Samples/Invoicing/InvoiceSettings/GetInvoiceSettings.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 9 | $merchantConfig = $commonElement->merchantConfigObject(); 10 | 11 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 12 | $api_instance = new CyberSource\Api\InvoiceSettingsApi($api_client); 13 | 14 | try { 15 | $apiResponse = $api_instance->getInvoiceSettings(); 16 | print_r(PHP_EOL); 17 | print_r($apiResponse); 18 | 19 | WriteLogAudit($apiResponse[1]); 20 | return $apiResponse; 21 | } catch (Cybersource\ApiException $e) { 22 | print_r($e->getResponseBody()); 23 | print_r($e->getMessage()); 24 | $errorCode = $e->getCode(); 25 | WriteLogAudit($errorCode); 26 | } 27 | } 28 | 29 | if (!function_exists('WriteLogAudit')){ 30 | function WriteLogAudit($status){ 31 | $sampleCode = basename(__FILE__, '.php'); 32 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 33 | } 34 | } 35 | 36 | if(!defined('DO_NOT_RUN_SAMPLES')){ 37 | echo "\nGetInvoiceSettings Sample Code is Running..." . PHP_EOL; 38 | GetInvoiceSettings(); 39 | } 40 | ?> 41 | -------------------------------------------------------------------------------- /Samples/Invoicing/Invoices/CancelInvoice.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\InvoicesApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->performCancelAction($invoiceId); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | 21 | WriteLogAudit($apiResponse[1]); 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')){ 39 | echo "\nCancelInvoice Sample Code is Running..." . PHP_EOL; 40 | CancelInvoice(); 41 | } 42 | ?> -------------------------------------------------------------------------------- /Samples/Invoicing/Invoices/GetInvoiceDetails.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\InvoicesApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->getInvoice($id); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | 21 | WriteLogAudit($apiResponse[1]); 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')){ 39 | echo "\nGetInvoiceDetails Sample Code is Running..." . PHP_EOL; 40 | GetInvoiceDetails(); 41 | } 42 | ?> 43 | -------------------------------------------------------------------------------- /Samples/Invoicing/Invoices/GetListOfInvoices.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 13 | $merchantConfig = $commonElement->merchantConfigObject(); 14 | 15 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 16 | $api_instance = new CyberSource\Api\InvoicesApi($api_client); 17 | 18 | try { 19 | $apiResponse = $api_instance->getAllInvoices($offset, $limit, $status); 20 | print_r(PHP_EOL); 21 | print_r($apiResponse); 22 | 23 | WriteLogAudit($apiResponse[1]); 24 | return $apiResponse; 25 | } catch (Cybersource\ApiException $e) { 26 | print_r($e->getResponseBody()); 27 | print_r($e->getMessage()); 28 | $errorCode = $e->getCode(); 29 | WriteLogAudit($errorCode); 30 | } 31 | } 32 | 33 | if (!function_exists('WriteLogAudit')){ 34 | function WriteLogAudit($status){ 35 | $sampleCode = basename(__FILE__, '.php'); 36 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 37 | } 38 | } 39 | 40 | if(!defined('DO_NOT_RUN_SAMPLES')){ 41 | echo "\nGetListOfInvoices Sample Code is Running..." . PHP_EOL; 42 | GetListOfInvoices(); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /Samples/Invoicing/Invoices/SendInvoice.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\InvoicesApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->performSendAction($invoiceId); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | 21 | WriteLogAudit($apiResponse[1]); 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')){ 39 | echo "\nSendInvoice Sample Code is Running..." . PHP_EOL; 40 | SendInvoice(); 41 | } 42 | ?> -------------------------------------------------------------------------------- /Samples/NetworkTokenization/CreateInstrumentIdentifierCardEnrollForNetworkToken.php: -------------------------------------------------------------------------------- 1 | "5204245750003216", 11 | "expirationMonth" => "12", 12 | "expirationYear" => "2025" 13 | ]; 14 | $card = new CyberSource\Model\TmsEmbeddedInstrumentIdentifierCard($cardArr); 15 | 16 | $requestObjArr = [ 17 | "type" => "enrollable card", 18 | "card" => $card 19 | ]; 20 | $requestObj = new CyberSource\Model\PostInstrumentIdentifierRequest($requestObjArr); 21 | 22 | 23 | $commonElement = new CyberSource\ExternalConfiguration(); 24 | $config = $commonElement->ConnectionHost(); 25 | $merchantConfig = $commonElement->merchantConfigObject(); 26 | 27 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 28 | $api_instance = new CyberSource\Api\InstrumentIdentifierApi($api_client); 29 | 30 | try { 31 | $apiResponse = $api_instance->postInstrumentIdentifier($requestObj, $profileid); 32 | print_r(PHP_EOL); 33 | print_r($apiResponse); 34 | 35 | WriteLogAudit($apiResponse[1]); 36 | return $apiResponse; 37 | } catch (Cybersource\ApiException $e) { 38 | print_r($e->getResponseBody()); 39 | print_r($e->getMessage()); 40 | $errorCode = $e->getCode(); 41 | WriteLogAudit($errorCode); 42 | } 43 | } 44 | 45 | if (!function_exists('WriteLogAudit')){ 46 | function WriteLogAudit($status){ 47 | $sampleCode = basename(__FILE__, '.php'); 48 | print_r("\n[Sample Code Testing] [$sampleCode] $status".PHP_EOL); 49 | } 50 | } 51 | 52 | if(!defined('DO_NOT_RUN_SAMPLES')){ 53 | echo "\nCreateInstrumentIdentifierCardEnrollForNetworkToken Sample Code is Running..." . PHP_EOL; 54 | CreateInstrumentIdentifierCardEnrollForNetworkToken(); 55 | } 56 | ?> 57 | -------------------------------------------------------------------------------- /Samples/NetworkTokenization/NetworkToken.php: -------------------------------------------------------------------------------- 1 | merchantConfigObject(); 15 | 16 | try { 17 | // Step-I 18 | $instrumentIdentifierForNetworkToken = CreateInstrumentIdentifierCardEnrollForNetworkToken(); 19 | $tokenID = $instrumentIdentifierForNetworkToken[0]['id']; 20 | 21 | //Step-II 22 | $encodedResponse = PaymentCredentialsFromNetworkToken($tokenID)[0]; 23 | 24 | //Step-III 25 | 26 | // The following method JWEUtility.decryptJWEResponse($encodedResponse, $merchantConfig) has been deprecated. 27 | // $decodedResponse = JWEUtility::decryptJWEResponse($encodedResponse, $merchantConfig); 28 | 29 | // Using the new method JWEUtility.decryptJWEResponseUsingPrivateKey($privateKey, $encodedResponse) instead 30 | $privateKey = file_get_contents($merchantConfig->getJwePEMFileDirectory()); 31 | $decodedResponse = JWEUtility::decryptJWEUsingPrivateKey($privateKey, $encodedResponse); 32 | 33 | print_r("Decoded Response".PHP_EOL); 34 | print_r($decodedResponse); 35 | 36 | } catch (Exception $e) { 37 | print_r($e); 38 | } 39 | 40 | } 41 | 42 | if (!function_exists('WriteLogAudit')){ 43 | function WriteLogAudit($status){ 44 | $sampleCode = basename(__FILE__, '.php'); 45 | print_r("\n[Sample Code Testing] [$sampleCode] $status".PHP_EOL); 46 | } 47 | } 48 | 49 | if(!defined('DO_NOT_RUN_SAMPLES')){ 50 | echo "\nNetworkToken Sample Code is Running..." . PHP_EOL; 51 | NetworkTokenization(); 52 | } 53 | -------------------------------------------------------------------------------- /Samples/NetworkTokenization/PaymentCredentialsFromNetworkToken.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 17 | $merchantConfig = $commonElement->merchantConfigObject(); 18 | 19 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 20 | $api_instance = new TokenApi($api_client); 21 | 22 | $postPaymentCredentialsRequest = new \CyberSource\Model\PostPaymentCredentialsRequest(); 23 | 24 | try { 25 | $apiResponse = $api_instance->postTokenPaymentCredentials($tokenID, $postPaymentCredentialsRequest, $profileid); 26 | print_r(PHP_EOL); 27 | print_r($apiResponse); 28 | 29 | WriteLogAudit($apiResponse[1]); 30 | return $apiResponse; 31 | } catch (Cybersource\ApiException $e) { 32 | print_r($e->getResponseBody()); 33 | print_r($e->getMessage()); 34 | $errorCode = $e->getCode(); 35 | WriteLogAudit($errorCode); 36 | } 37 | 38 | } 39 | 40 | if (!function_exists('WriteLogAudit')){ 41 | function WriteLogAudit($status){ 42 | $sampleCode = basename(__FILE__, '.php'); 43 | print_r("\n[Sample Code Testing] [$sampleCode] $status".PHP_EOL); 44 | } 45 | } 46 | 47 | if(!defined('DO_NOT_RUN_SAMPLES')){ 48 | echo "\nPaymentCredentialsForNetworkToken Sample Code is Running..." . PHP_EOL; 49 | PaymentCredentialsFromNetworkToken(); 50 | } 51 | -------------------------------------------------------------------------------- /Samples/PayerAuthentication/SetupCompletionWithFlexTransientToken.php: -------------------------------------------------------------------------------- 1 | "cybs_test" 9 | ]; 10 | $clientReferenceInformation = new CyberSource\Model\Riskv1authenticationsetupsClientReferenceInformation($clientReferenceInformationArr); 11 | 12 | $tokenInformationArr = [ 13 | "transientToken" => "1D5ZX4HMOV20FKEBE3IO240JWYJ0NJ90B4V9XQ6SCK4BDN0W96E65E2A39052056" 14 | ]; 15 | $tokenInformation = new CyberSource\Model\Riskv1authenticationsetupsTokenInformation($tokenInformationArr); 16 | 17 | $requestObjArr = [ 18 | "clientReferenceInformation" => $clientReferenceInformation, 19 | "tokenInformation" => $tokenInformation 20 | ]; 21 | $requestObj = new CyberSource\Model\PayerAuthSetupRequest($requestObjArr); 22 | 23 | 24 | $commonElement = new CyberSource\ExternalConfiguration(); 25 | $config = $commonElement->ConnectionHost(); 26 | $merchantConfig = $commonElement->merchantConfigObject(); 27 | 28 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 29 | $api_instance = new CyberSource\Api\PayerAuthenticationApi($api_client); 30 | 31 | try { 32 | $apiResponse = $api_instance->payerAuthSetup($requestObj); 33 | print_r(PHP_EOL); 34 | print_r($apiResponse); 35 | 36 | WriteLogAudit($apiResponse[1]); 37 | return $apiResponse; 38 | } catch (Cybersource\ApiException $e) { 39 | print_r($e->getResponseBody()); 40 | print_r($e->getMessage()); 41 | $errorCode = $e->getCode(); 42 | WriteLogAudit($errorCode); 43 | } 44 | } 45 | 46 | if (!function_exists('WriteLogAudit')){ 47 | function WriteLogAudit($status){ 48 | $sampleCode = basename(__FILE__, '.php'); 49 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 50 | } 51 | } 52 | 53 | if(!defined('DO_NOT_RUN_SAMPLES')){ 54 | echo "\nSetupCompletionWithFlexTransientToken Sample Code is Running..." . PHP_EOL; 55 | SetupCompletionWithFlexTransientToken(); 56 | } 57 | ?> 58 | -------------------------------------------------------------------------------- /Samples/PayerAuthentication/SetupCompletionWithSecureStorageToken.php: -------------------------------------------------------------------------------- 1 | "cybs_test" 9 | ]; 10 | $clientReferenceInformation = new CyberSource\Model\Riskv1authenticationsetupsClientReferenceInformation($clientReferenceInformationArr); 11 | 12 | $paymentInformationCustomerArr = [ 13 | "customerId" => "5795045921830181636348" 14 | ]; 15 | $paymentInformationCustomer = new CyberSource\Model\Riskv1authenticationsetupsPaymentInformationCustomer($paymentInformationCustomerArr); 16 | 17 | $paymentInformationArr = [ 18 | "customer" => $paymentInformationCustomer 19 | ]; 20 | $paymentInformation = new CyberSource\Model\Riskv1authenticationsetupsPaymentInformation($paymentInformationArr); 21 | 22 | $requestObjArr = [ 23 | "clientReferenceInformation" => $clientReferenceInformation, 24 | "paymentInformation" => $paymentInformation 25 | ]; 26 | $requestObj = new CyberSource\Model\PayerAuthSetupRequest($requestObjArr); 27 | 28 | 29 | $commonElement = new CyberSource\ExternalConfiguration(); 30 | $config = $commonElement->ConnectionHost(); 31 | $merchantConfig = $commonElement->merchantConfigObject(); 32 | 33 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 34 | $api_instance = new CyberSource\Api\PayerAuthenticationApi($api_client); 35 | 36 | try { 37 | $apiResponse = $api_instance->payerAuthSetup($requestObj); 38 | print_r(PHP_EOL); 39 | print_r($apiResponse); 40 | 41 | WriteLogAudit($apiResponse[1]); 42 | return $apiResponse; 43 | } catch (Cybersource\ApiException $e) { 44 | print_r($e->getResponseBody()); 45 | print_r($e->getMessage()); 46 | $errorCode = $e->getCode(); 47 | WriteLogAudit($errorCode); 48 | } 49 | } 50 | 51 | if (!function_exists('WriteLogAudit')){ 52 | function WriteLogAudit($status){ 53 | $sampleCode = basename(__FILE__, '.php'); 54 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 55 | } 56 | } 57 | 58 | if(!defined('DO_NOT_RUN_SAMPLES')){ 59 | echo "\nSetupCompletionWithSecureStorageToken Sample Code is Running..." . PHP_EOL; 60 | SetupCompletionWithSecureStorageToken(); 61 | } 62 | ?> 63 | -------------------------------------------------------------------------------- /Samples/PayerAuthentication/SetupCompletionWithTMSToken.php: -------------------------------------------------------------------------------- 1 | "cybs_test" 9 | ]; 10 | $clientReferenceInformation = new CyberSource\Model\Riskv1authenticationsetupsClientReferenceInformation($clientReferenceInformationArr); 11 | 12 | $paymentInformationCustomerArr = [ 13 | "customerId" => "AB695DA801DD1BB6E05341588E0A3BDC" 14 | ]; 15 | $paymentInformationCustomer = new CyberSource\Model\Riskv1authenticationsetupsPaymentInformationCustomer($paymentInformationCustomerArr); 16 | 17 | $paymentInformationArr = [ 18 | "customer" => $paymentInformationCustomer 19 | ]; 20 | $paymentInformation = new CyberSource\Model\Riskv1authenticationsetupsPaymentInformation($paymentInformationArr); 21 | 22 | $requestObjArr = [ 23 | "clientReferenceInformation" => $clientReferenceInformation, 24 | "paymentInformation" => $paymentInformation 25 | ]; 26 | $requestObj = new CyberSource\Model\PayerAuthSetupRequest($requestObjArr); 27 | 28 | 29 | $commonElement = new CyberSource\ExternalConfiguration(); 30 | $config = $commonElement->ConnectionHost(); 31 | $merchantConfig = $commonElement->merchantConfigObject(); 32 | 33 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 34 | $api_instance = new CyberSource\Api\PayerAuthenticationApi($api_client); 35 | 36 | try { 37 | $apiResponse = $api_instance->payerAuthSetup($requestObj); 38 | print_r(PHP_EOL); 39 | print_r($apiResponse); 40 | 41 | WriteLogAudit($apiResponse[1]); 42 | return $apiResponse; 43 | } catch (Cybersource\ApiException $e) { 44 | print_r($e->getResponseBody()); 45 | print_r($e->getMessage()); 46 | $errorCode = $e->getCode(); 47 | WriteLogAudit($errorCode); 48 | } 49 | } 50 | 51 | if (!function_exists('WriteLogAudit')){ 52 | function WriteLogAudit($status){ 53 | $sampleCode = basename(__FILE__, '.php'); 54 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 55 | } 56 | } 57 | 58 | if(!defined('DO_NOT_RUN_SAMPLES')){ 59 | echo "\nSetupCompletionWithTMSToken Sample Code is Running..." . PHP_EOL; 60 | SetupCompletionWithTMSToken(); 61 | } 62 | ?> 63 | -------------------------------------------------------------------------------- /Samples/Payments/Void/TimeoutVoid.php: -------------------------------------------------------------------------------- 1 | "TC50171_3", 11 | "transactionId" => $timeoutVoidTransactionId 12 | ]; 13 | $clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsClientReferenceInformation($clientReferenceInformationArr); 14 | 15 | $requestObjArr = [ 16 | "clientReferenceInformation" => $clientReferenceInformation 17 | ]; 18 | $requestObj = new CyberSource\Model\MitVoidRequest($requestObjArr); 19 | 20 | 21 | $commonElement = new CyberSource\ExternalConfiguration(); 22 | $config = $commonElement->ConnectionHost(); 23 | $merchantConfig = $commonElement->merchantConfigObject(); 24 | 25 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 26 | $api_instance = new CyberSource\Api\VoidApi($api_client); 27 | 28 | try { 29 | $apiResponse = $api_instance->mitVoid($requestObj); 30 | print_r(PHP_EOL); 31 | print_r($apiResponse); 32 | 33 | WriteLogAudit($apiResponse[1]); 34 | return $apiResponse; 35 | } catch (Cybersource\ApiException $e) { 36 | print_r($e->getResponseBody()); 37 | print_r($e->getMessage()); 38 | $errorCode = $e->getCode(); 39 | WriteLogAudit($errorCode); 40 | } 41 | } 42 | 43 | if (!function_exists('WriteLogAudit')){ 44 | function WriteLogAudit($status){ 45 | $sampleCode = basename(__FILE__, '.php'); 46 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 47 | } 48 | } 49 | 50 | if(!defined('DO_NOT_RUN_SAMPLES')){ 51 | echo "\nTimeoutVoid Sample Code is Running..." . PHP_EOL; 52 | TimeoutVoid(); 53 | } 54 | ?> 55 | -------------------------------------------------------------------------------- /Samples/Payments/Void/VoidCapture.php: -------------------------------------------------------------------------------- 1 | "test_void" 12 | ]; 13 | $clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsidreversalsClientReferenceInformation($clientReferenceInformationArr); 14 | 15 | $requestObjArr = [ 16 | "clientReferenceInformation" => $clientReferenceInformation 17 | ]; 18 | $requestObj = new CyberSource\Model\VoidCaptureRequest($requestObjArr); 19 | 20 | 21 | $commonElement = new CyberSource\ExternalConfiguration(); 22 | $config = $commonElement->ConnectionHost(); 23 | $merchantConfig = $commonElement->merchantConfigObject(); 24 | 25 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 26 | $api_instance = new CyberSource\Api\VoidApi($api_client); 27 | 28 | try { 29 | $apiResponse = $api_instance->voidCapture($requestObj, $id); 30 | print_r(PHP_EOL); 31 | print_r($apiResponse); 32 | 33 | WriteLogAudit($apiResponse[1]); 34 | return $apiResponse; 35 | } catch (Cybersource\ApiException $e) { 36 | print_r($e->getResponseBody()); 37 | print_r($e->getMessage()); 38 | $errorCode = $e->getCode(); 39 | WriteLogAudit($errorCode); 40 | } 41 | } 42 | 43 | if (!function_exists('WriteLogAudit')){ 44 | function WriteLogAudit($status){ 45 | $sampleCode = basename(__FILE__, '.php'); 46 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 47 | } 48 | } 49 | 50 | if(!defined('DO_NOT_RUN_SAMPLES')){ 51 | echo "\nVoidCapture Sample Code is Running..." . PHP_EOL; 52 | VoidCapture(); 53 | } 54 | ?> 55 | -------------------------------------------------------------------------------- /Samples/Payments/Void/VoidCredit.php: -------------------------------------------------------------------------------- 1 | "test_void" 12 | ]; 13 | $clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsidreversalsClientReferenceInformation($clientReferenceInformationArr); 14 | 15 | $requestObjArr = [ 16 | "clientReferenceInformation" => $clientReferenceInformation 17 | ]; 18 | $requestObj = new CyberSource\Model\VoidCreditRequest($requestObjArr); 19 | 20 | 21 | $commonElement = new CyberSource\ExternalConfiguration(); 22 | $config = $commonElement->ConnectionHost(); 23 | $merchantConfig = $commonElement->merchantConfigObject(); 24 | 25 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 26 | $api_instance = new CyberSource\Api\VoidApi($api_client); 27 | 28 | try { 29 | $apiResponse = $api_instance->voidCredit($requestObj, $id); 30 | print_r(PHP_EOL); 31 | print_r($apiResponse); 32 | 33 | WriteLogAudit($apiResponse[1]); 34 | return $apiResponse; 35 | } catch (Cybersource\ApiException $e) { 36 | print_r($e->getResponseBody()); 37 | print_r($e->getMessage()); 38 | $errorCode = $e->getCode(); 39 | WriteLogAudit($errorCode); 40 | } 41 | } 42 | 43 | if (!function_exists('WriteLogAudit')){ 44 | function WriteLogAudit($status){ 45 | $sampleCode = basename(__FILE__, '.php'); 46 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 47 | } 48 | } 49 | 50 | if(!defined('DO_NOT_RUN_SAMPLES')){ 51 | echo "\nVoidCredit Sample Code is Running..." . PHP_EOL; 52 | VoidCredit(); 53 | } 54 | ?> 55 | -------------------------------------------------------------------------------- /Samples/Payments/Void/VoidPayment.php: -------------------------------------------------------------------------------- 1 | "test_void" 12 | ]; 13 | $clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsidreversalsClientReferenceInformation($clientReferenceInformationArr); 14 | 15 | $requestObjArr = [ 16 | "clientReferenceInformation" => $clientReferenceInformation 17 | ]; 18 | $requestObj = new CyberSource\Model\VoidPaymentRequest($requestObjArr); 19 | 20 | 21 | $commonElement = new CyberSource\ExternalConfiguration(); 22 | $config = $commonElement->ConnectionHost(); 23 | $merchantConfig = $commonElement->merchantConfigObject(); 24 | 25 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 26 | $api_instance = new CyberSource\Api\VoidApi($api_client); 27 | 28 | try { 29 | $apiResponse = $api_instance->voidPayment($requestObj, $id); 30 | print_r(PHP_EOL); 31 | print_r($apiResponse); 32 | 33 | WriteLogAudit($apiResponse[1]); 34 | return $apiResponse; 35 | } catch (Cybersource\ApiException $e) { 36 | print_r($e->getResponseBody()); 37 | print_r($e->getMessage()); 38 | $errorCode = $e->getCode(); 39 | WriteLogAudit($errorCode); 40 | } 41 | } 42 | 43 | if (!function_exists('WriteLogAudit')){ 44 | function WriteLogAudit($status){ 45 | $sampleCode = basename(__FILE__, '.php'); 46 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 47 | } 48 | } 49 | 50 | if(!defined('DO_NOT_RUN_SAMPLES')){ 51 | echo "\nVoidPayment Sample Code is Running..." . PHP_EOL; 52 | VoidPayment(); 53 | } 54 | ?> 55 | -------------------------------------------------------------------------------- /Samples/Payments/Void/VoidRefund.php: -------------------------------------------------------------------------------- 1 | "test_void" 12 | ]; 13 | $clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsidreversalsClientReferenceInformation($clientReferenceInformationArr); 14 | 15 | $requestObjArr = [ 16 | "clientReferenceInformation" => $clientReferenceInformation 17 | ]; 18 | $requestObj = new CyberSource\Model\VoidRefundRequest($requestObjArr); 19 | 20 | 21 | $commonElement = new CyberSource\ExternalConfiguration(); 22 | $config = $commonElement->ConnectionHost(); 23 | $merchantConfig = $commonElement->merchantConfigObject(); 24 | 25 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 26 | $api_instance = new CyberSource\Api\VoidApi($api_client); 27 | 28 | try { 29 | $apiResponse = $api_instance->voidRefund($requestObj, $id); 30 | print_r(PHP_EOL); 31 | print_r($apiResponse); 32 | 33 | WriteLogAudit($apiResponse[1]); 34 | return $apiResponse; 35 | } catch (Cybersource\ApiException $e) { 36 | print_r($e->getResponseBody()); 37 | print_r($e->getMessage()); 38 | $errorCode = $e->getCode(); 39 | WriteLogAudit($errorCode); 40 | } 41 | } 42 | 43 | if (!function_exists('WriteLogAudit')){ 44 | function WriteLogAudit($status){ 45 | $sampleCode = basename(__FILE__, '.php'); 46 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 47 | } 48 | } 49 | 50 | if(!defined('DO_NOT_RUN_SAMPLES')){ 51 | echo "\nVoidRefund Sample Code is Running..." . PHP_EOL; 52 | VoidRefund(); 53 | } 54 | ?> 55 | -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Plans/ActivatePlan.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\PlansApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->activatePlan($planId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | WriteLogAudit($apiResponse[1]); 22 | 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')) { 40 | echo "\nActivatePlan Sample Code is Running..." . PHP_EOL; 41 | ActivatePlan(); 42 | } 43 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Plans/DeactivatePlan.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\PlansApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->deactivatePlan($planId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | WriteLogAudit($apiResponse[1]); 22 | 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')) { 40 | echo "\nDeactivatePlan Sample Code is Running..." . PHP_EOL; 41 | DeactivatePlan(); 42 | } 43 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Plans/DeletePlan.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\PlansApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->deletePlan($id); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | WriteLogAudit($apiResponse[1]); 21 | 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')) { 39 | echo "\nDeletePlan Sample Code is Running..." . PHP_EOL; 40 | DeletePlan(); 41 | } 42 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Plans/GetListOfPlans.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 15 | $merchantConfig = $commonElement->merchantConfigObject(); 16 | 17 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 18 | $api_instance = new CyberSource\Api\PlansApi($api_client); 19 | 20 | try { 21 | $apiResponse = $api_instance->getPlans($offset, $limit, $code, $status, $name); 22 | print_r(PHP_EOL); 23 | print_r($apiResponse); 24 | WriteLogAudit($apiResponse[1]); 25 | 26 | return $apiResponse; 27 | } catch (Cybersource\ApiException $e) { 28 | print_r($e->getResponseBody()); 29 | print_r($e->getMessage()); 30 | $errorCode = $e->getCode(); 31 | WriteLogAudit($errorCode); 32 | } 33 | } 34 | 35 | if (!function_exists('WriteLogAudit')){ 36 | function WriteLogAudit($status){ 37 | $sampleCode = basename(__FILE__, '.php'); 38 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 39 | } 40 | } 41 | 42 | if(!defined('DO_NOT_RUN_SAMPLES')) { 43 | echo "\nGetListOfPlans Sample Code is Running..." . PHP_EOL; 44 | GetListOfPlans(); 45 | } 46 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Plans/GetPlan.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\PlansApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->getPlan($planId); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | WriteLogAudit($apiResponse[1]); 21 | 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')) { 39 | echo "\nGetPlan Sample Code is Running..." . PHP_EOL; 40 | GetPlan(); 41 | } 42 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Plans/GetPlanCode.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 9 | $merchantConfig = $commonElement->merchantConfigObject(); 10 | 11 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 12 | $api_instance = new CyberSource\Api\PlansApi($api_client); 13 | 14 | try { 15 | $apiResponse = $api_instance->getPlanCode(); 16 | print_r(PHP_EOL); 17 | print_r($apiResponse); 18 | WriteLogAudit($apiResponse[1]); 19 | 20 | return $apiResponse; 21 | } catch (Cybersource\ApiException $e) { 22 | print_r($e->getResponseBody()); 23 | print_r($e->getMessage()); 24 | $errorCode = $e->getCode(); 25 | WriteLogAudit($errorCode); 26 | } 27 | } 28 | 29 | if (!function_exists('WriteLogAudit')){ 30 | function WriteLogAudit($status){ 31 | $sampleCode = basename(__FILE__, '.php'); 32 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 33 | } 34 | } 35 | 36 | if(!defined('DO_NOT_RUN_SAMPLES')) { 37 | echo "\nGetPlanCode Sample Code is Running..." . PHP_EOL; 38 | GetPlanCode(); 39 | } 40 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Subscriptions/ActivateSubscription.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\SubscriptionsApi($api_client); 15 | 16 | try { 17 | $subscriptionId = CancelSubscription()[0]['id']; 18 | $apiResponse = $api_instance->activateSubscription($subscriptionId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | WriteLogAudit($apiResponse[1]); 22 | 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | 26 | print_r($e->getResponseBody()); 27 | print_r($e->getMessage()); 28 | $errorCode = $e->getCode(); 29 | WriteLogAudit($errorCode); 30 | } 31 | catch (Exception $e) { 32 | 33 | // print_r($e->getResponseBody()); 34 | print_r($e->getMessage()); 35 | $errorCode = $e->getCode(); 36 | WriteLogAudit($errorCode); 37 | } 38 | } 39 | 40 | if (!function_exists('WriteLogAudit')){ 41 | function WriteLogAudit($status){ 42 | $sampleCode = basename(__FILE__, '.php'); 43 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 44 | } 45 | } 46 | 47 | if(!defined('DO_NOT_RUN_SAMPLES')) { 48 | echo "\nActivateSubscription Sample Code is Running..." . PHP_EOL; 49 | ActivateSubscription(); 50 | } 51 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Subscriptions/CancelSubscription.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\SubscriptionsApi($api_client); 15 | 16 | try { 17 | $subscriptionId = CreateSubscription()[0]['id']; 18 | $apiResponse = $api_instance->cancelSubscription($subscriptionId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | WriteLogAudit($apiResponse[1]); 22 | 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | catch (Exception $e) { 31 | // print_r($e->getResponseBody()); 32 | print_r($e->getMessage()); 33 | $errorCode = $e->getCode(); 34 | WriteLogAudit($errorCode); 35 | } 36 | } 37 | 38 | 39 | 40 | if (!function_exists('WriteLogAudit')){ 41 | function WriteLogAudit($status){ 42 | $sampleCode = basename(__FILE__, '.php'); 43 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 44 | } 45 | } 46 | 47 | if(!defined('DO_NOT_RUN_SAMPLES')) { 48 | echo "\nCancelSubscription Sample Code is Running..." . PHP_EOL; 49 | CancelSubscription(); 50 | } 51 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Subscriptions/GetListOfSubscriptions.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\SubscriptionsApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->getAllSubscriptions($offset, $limit, $code, $status); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | WriteLogAudit($apiResponse[1]); 24 | 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')) { 42 | echo "\nGetListOfSubscriptions Sample Code is Running..." . PHP_EOL; 43 | GetListOfSubscriptions(); 44 | } 45 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Subscriptions/GetSubscription.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\SubscriptionsApi($api_client); 15 | 16 | try { 17 | $id = CreateSubscription()[0]['id']; 18 | $apiResponse = $api_instance->getSubscription($id); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | WriteLogAudit($apiResponse[1]); 22 | 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | catch (Exception $e) { 31 | // print_r($e->getResponseBody()); 32 | print_r($e->getMessage()); 33 | $errorCode = $e->getCode(); 34 | WriteLogAudit($errorCode); 35 | } 36 | } 37 | 38 | if (!function_exists('WriteLogAudit')){ 39 | function WriteLogAudit($status){ 40 | $sampleCode = basename(__FILE__, '.php'); 41 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 42 | } 43 | } 44 | 45 | if(!defined('DO_NOT_RUN_SAMPLES')) { 46 | echo "\nGetSubscription Sample Code is Running..." . PHP_EOL; 47 | GetSubscription(); 48 | } 49 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Subscriptions/GetSubscriptionCode.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 9 | $merchantConfig = $commonElement->merchantConfigObject(); 10 | 11 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 12 | $api_instance = new CyberSource\Api\SubscriptionsApi($api_client); 13 | 14 | try { 15 | $apiResponse = $api_instance->getSubscriptionCode(); 16 | print_r(PHP_EOL); 17 | print_r($apiResponse); 18 | WriteLogAudit($apiResponse[1]); 19 | 20 | return $apiResponse; 21 | } catch (Cybersource\ApiException $e) { 22 | print_r($e->getResponseBody()); 23 | print_r($e->getMessage()); 24 | $errorCode = $e->getCode(); 25 | WriteLogAudit($errorCode); 26 | } 27 | } 28 | 29 | if (!function_exists('WriteLogAudit')){ 30 | function WriteLogAudit($status){ 31 | $sampleCode = basename(__FILE__, '.php'); 32 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 33 | } 34 | } 35 | 36 | if(!defined('DO_NOT_RUN_SAMPLES')) { 37 | echo "\nGetSubscriptionCode Sample Code is Running..." . PHP_EOL; 38 | GetSubscriptionCode(); 39 | } 40 | ?> -------------------------------------------------------------------------------- /Samples/RecurringBillingSubscriptions/Subscriptions/SuspendSubscription.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\SubscriptionsApi($api_client); 15 | 16 | try { 17 | $subscriptionId = CreateSubscription()[0]['id']; 18 | $apiResponse = $api_instance->suspendSubscription($subscriptionId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | WriteLogAudit($apiResponse[1]); 22 | 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | catch (Exception $e) { 31 | // print_r($e->getResponseBody()); 32 | print_r($e->getMessage()); 33 | $errorCode = $e->getCode(); 34 | WriteLogAudit($errorCode); 35 | } 36 | } 37 | 38 | if (!function_exists('WriteLogAudit')){ 39 | function WriteLogAudit($status){ 40 | $sampleCode = basename(__FILE__, '.php'); 41 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 42 | } 43 | } 44 | 45 | if(!defined('DO_NOT_RUN_SAMPLES')) { 46 | echo "\nSuspendSubscription Sample Code is Running..." . PHP_EOL; 47 | SuspendSubscription(); 48 | } 49 | ?> -------------------------------------------------------------------------------- /Samples/Reporting/ChargebackDetails/GetChargebackDetails.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $apiClient = new CyberSource\ApiClient($config, $merchantConfig); 17 | $apiInstance = new CyberSource\Api\ChargebackDetailsApi($apiClient); 18 | 19 | try { 20 | $apiResponse = $apiInstance->getChargebackDetails($startTime, $endTime, $organizationId); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if (!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nGetChargebackDetails Sample Code is Running..." . PHP_EOL; 43 | GetChargebackDetails(); 44 | } -------------------------------------------------------------------------------- /Samples/Reporting/ChargebackSummaries/GetChargebackSummaries.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $apiClient = new CyberSource\ApiClient($config, $merchantConfig); 17 | $apiInstance = new CyberSource\Api\ChargebackSummariesApi($apiClient); 18 | 19 | try { 20 | $apiResponse = $apiInstance->getChargebackSummaries($startTime, $endTime, $organizationId); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if (!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nGetChargebackSummaries Sample Code is Running..." . PHP_EOL; 43 | GetChargebackSummaries(); 44 | } -------------------------------------------------------------------------------- /Samples/Reporting/ConversionDetails/GetConversionDetailTransactions.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 13 | $merchantConfig = $commonElement->merchantConfigObject(); 14 | 15 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 16 | $api_instance = new CyberSource\Api\ConversionDetailsApi($api_client); 17 | 18 | try { 19 | $apiResponse = $api_instance->getConversionDetail($startTime, $endTime, $organizationId); 20 | print_r(PHP_EOL); 21 | print_r($apiResponse); 22 | 23 | WriteLogAudit($apiResponse[1]); 24 | return $apiResponse; 25 | } catch (Cybersource\ApiException $e) { 26 | print_r($e->getResponseBody()); 27 | print_r($e->getMessage()); 28 | $errorCode = $e->getCode(); 29 | WriteLogAudit($errorCode); 30 | } 31 | } 32 | 33 | if (!function_exists('WriteLogAudit')){ 34 | function WriteLogAudit($status){ 35 | $sampleCode = basename(__FILE__, '.php'); 36 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 37 | } 38 | } 39 | 40 | if(!defined('DO_NOT_RUN_SAMPLES')){ 41 | echo "\nGetConversionDetailTransactions Sample Code is Running..." . PHP_EOL; 42 | GetConversionDetailTransactions(); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /Samples/Reporting/InterchangeClearingLevelDetails/InterchangeClearingLevelDataForAccountOrMerchant.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $apiClient = new CyberSource\ApiClient($config, $merchantConfig); 17 | $apiInstance = new CyberSource\Api\InterchangeClearingLevelDetailsApi($apiClient); 18 | 19 | try { 20 | $apiResponse = $apiInstance->getInterchangeClearingLevelDetails($startTime, $endTime, $organizationId); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if (!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nInterchangeClearingLevelDataForAccountOrMerchant Sample Code is Running..." . PHP_EOL; 43 | InterchangeClearingLevelDataForAccountOrMerchant(); 44 | } -------------------------------------------------------------------------------- /Samples/Reporting/NetFundings/GetNetfundingInformationForAccountOrMerchant.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\NetFundingsApi($api_client); 18 | 19 | 20 | try { 21 | $apiResponse = $api_instance->getNetFundingDetails($startTime, $endTime, $organizationId, $groupName); 22 | print_r(PHP_EOL); 23 | print_r($apiResponse); 24 | 25 | WriteLogAudit($apiResponse[1]); 26 | return $apiResponse; 27 | } catch (Cybersource\ApiException $e) { 28 | print_r($e->getResponseBody()); 29 | print_r($e->getMessage()); 30 | $errorCode = $e->getCode(); 31 | WriteLogAudit($errorCode); 32 | } 33 | } 34 | 35 | if (!function_exists('WriteLogAudit')){ 36 | function WriteLogAudit($status){ 37 | $sampleCode = basename(__FILE__, '.php'); 38 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 39 | } 40 | } 41 | 42 | if(!defined('DO_NOT_RUN_SAMPLES')){ 43 | echo "\nGetNetfundingInformationForAccountOrMerchant Sample Code is Running..." . PHP_EOL; 44 | GetNetfundingInformationForAccountOrMerchant(); 45 | } 46 | ?> 47 | -------------------------------------------------------------------------------- /Samples/Reporting/NotificationOfChanges/GetNotificationOfChanges.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\NotificationOfChangesApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->getNotificationOfChangeReport($startTime, $endTime); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | echo "\nGetNotificationOfChanges Sample Code is Running..." . PHP_EOL; 41 | GetNotificationOfChanges(); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /Samples/Reporting/PaymentBatchSummaries/GetPaymentBatchSummaryData.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 16 | $merchantConfig = $commonElement->merchantConfigObject(); 17 | 18 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 19 | $api_instance = new CyberSource\Api\PaymentBatchSummariesApi($api_client); 20 | 21 | try { 22 | $apiResponse = $api_instance->getPaymentBatchSummary($startTime, $endTime, $organizationId, $rollUp, $breakdown, $startDayOfWeek); 23 | print_r(PHP_EOL); 24 | print_r($apiResponse); 25 | 26 | WriteLogAudit($apiResponse[1]); 27 | return $apiResponse; 28 | } catch (Cybersource\ApiException $e) { 29 | print_r($e->getResponseBody()); 30 | print_r($e->getMessage()); 31 | $errorCode = $e->getCode(); 32 | WriteLogAudit($errorCode); 33 | } 34 | } 35 | 36 | if (!function_exists('WriteLogAudit')){ 37 | function WriteLogAudit($status){ 38 | $sampleCode = basename(__FILE__, '.php'); 39 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 40 | } 41 | } 42 | 43 | if(!defined('DO_NOT_RUN_SAMPLES')){ 44 | echo "\nGetPaymentBatchSummaryData Sample Code is Running..." . PHP_EOL; 45 | GetPaymentBatchSummaryData(); 46 | } 47 | ?> 48 | -------------------------------------------------------------------------------- /Samples/Reporting/PurchaseAndRefundDetails/GetPurchaseAndRefundDetails.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 18 | $merchantConfig = $commonElement->merchantConfigObject(); 19 | 20 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 21 | $api_instance = new CyberSource\Api\PurchaseAndRefundDetailsApi($api_client); 22 | 23 | try { 24 | $apiResponse = $api_instance->getPurchaseAndRefundDetails($startTime, $endTime, $organizationId, $paymentSubtype, $viewBy, $groupName, $offset, $limit); 25 | print_r(PHP_EOL); 26 | print_r($apiResponse); 27 | 28 | WriteLogAudit($apiResponse[1]); 29 | return $apiResponse; 30 | } catch (Cybersource\ApiException $e) { 31 | print_r($e->getResponseBody()); 32 | print_r($e->getMessage()); 33 | $errorCode = $e->getCode(); 34 | WriteLogAudit($errorCode); 35 | } 36 | } 37 | 38 | if (!function_exists('WriteLogAudit')){ 39 | function WriteLogAudit($status){ 40 | $sampleCode = basename(__FILE__, '.php'); 41 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 42 | } 43 | } 44 | 45 | if(!defined('DO_NOT_RUN_SAMPLES')){ 46 | echo "\nGetPurchaseAndRefundDetails Sample Code is Running..." . PHP_EOL; 47 | GetPurchaseAndRefundDetails(); 48 | } 49 | ?> 50 | -------------------------------------------------------------------------------- /Samples/Reporting/ReportDefinitions/GetReportDefinition.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\ReportDefinitionsApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->getResourceInfoByReportDefinition($reportDefinitionName, $subscriptionType, $reportMimeType, $organizationId); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nGetReportDefinition Sample Code is Running..." . PHP_EOL; 43 | GetReportDefinition(); 44 | } 45 | ?> 46 | -------------------------------------------------------------------------------- /Samples/Reporting/ReportDefinitions/GetReportingResourceInformation.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\ReportDefinitionsApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->getResourceV2Info($subscriptionType, $organizationId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | echo "\nGetReportingResourceInformation Sample Code is Running..." . PHP_EOL; 41 | GetReportingResourceInformation(); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /Samples/Reporting/ReportDownloads/DownloadReport.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\ReportDownloadsApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->downloadReport($reportDate, $reportName, $organizationId, $reportTime); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | $download_data = $apiResponse[0]; 25 | $file_path = $commonElement->downloadReport($download_data, "DownloadedReport.xml"); 26 | echo "File downloaded in the location: \n" . $file_path . "\n"; 27 | WriteLogAudit($apiResponse[1]); 28 | return $apiResponse; 29 | } catch (Cybersource\ApiException $e) { 30 | print_r($e->getResponseBody()); 31 | print_r($e->getMessage()); 32 | $errorCode = $e->getCode(); 33 | WriteLogAudit($errorCode); 34 | } 35 | } 36 | 37 | if (!function_exists('WriteLogAudit')){ 38 | function WriteLogAudit($status){ 39 | $sampleCode = basename(__FILE__, '.php'); 40 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 41 | } 42 | } 43 | 44 | if(!defined('DO_NOT_RUN_SAMPLES')){ 45 | echo "\nDownloadReport Sample Code is Running..." . PHP_EOL; 46 | DownloadReport(); 47 | } 48 | ?> 49 | -------------------------------------------------------------------------------- /Samples/Reporting/ReportSubscriptions/CreateClassicStandardReportSubscription.php: -------------------------------------------------------------------------------- 1 | "TransactionRequestClass", 9 | "subscriptionType" => "CLASSIC" 10 | ]; 11 | $requestObj = new CyberSource\Model\PredefinedSubscriptionRequestBean($requestObjArr); 12 | 13 | $organizationId = null; 14 | 15 | $commonElement = new CyberSource\ExternalConfiguration(); 16 | $config = $commonElement->ConnectionHost(); 17 | $merchantConfig = $commonElement->merchantConfigObject(); 18 | 19 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 20 | $api_instance = new CyberSource\Api\ReportSubscriptionsApi($api_client); 21 | 22 | try { 23 | $apiResponse = $api_instance->createStandardOrClassicSubscription($requestObj, $organizationId); 24 | print_r(PHP_EOL); 25 | print_r($apiResponse); 26 | 27 | WriteLogAudit($apiResponse[1]); 28 | return $apiResponse; 29 | } catch (Cybersource\ApiException $e) { 30 | print_r($e->getResponseBody()); 31 | print_r($e->getMessage()); 32 | $errorCode = $e->getCode(); 33 | WriteLogAudit($errorCode); 34 | } 35 | } 36 | 37 | if (!function_exists('WriteLogAudit')){ 38 | function WriteLogAudit($status){ 39 | $sampleCode = basename(__FILE__, '.php'); 40 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 41 | } 42 | } 43 | 44 | if(!defined('DO_NOT_RUN_SAMPLES')){ 45 | echo "\nCreateClassicStandardReportSubscription Sample Code is Running..." . PHP_EOL; 46 | CreateClassicStandardReportSubscription(); 47 | } 48 | ?> 49 | -------------------------------------------------------------------------------- /Samples/Reporting/ReportSubscriptions/CreateReportSubscription.php: -------------------------------------------------------------------------------- 1 | "TransactionRequestClass", 14 | "reportFields" => $reportFields, 15 | "reportMimeType" => "application/xml", 16 | "reportFrequency" => "WEEKLY", 17 | "reportName" => "testrest_subcription_v1", 18 | "timezone" => "GMT", 19 | "startTime" => "0900", 20 | "startDay" => 1 21 | ]; 22 | $requestObj = new CyberSource\Model\CreateReportSubscriptionRequest($requestObjArr); 23 | 24 | $organizationId = null; 25 | 26 | $commonElement = new CyberSource\ExternalConfiguration(); 27 | $config = $commonElement->ConnectionHost(); 28 | $merchantConfig = $commonElement->merchantConfigObject(); 29 | 30 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 31 | $api_instance = new CyberSource\Api\ReportSubscriptionsApi($api_client); 32 | 33 | try { 34 | $apiResponse = $api_instance->createSubscription($requestObj, $organizationId); 35 | print_r(PHP_EOL); 36 | print_r($apiResponse); 37 | 38 | WriteLogAudit($apiResponse[1]); 39 | return $apiResponse; 40 | } catch (Cybersource\ApiException $e) { 41 | print_r($e->getResponseBody()); 42 | print_r($e->getMessage()); 43 | $errorCode = $e->getCode(); 44 | WriteLogAudit($errorCode); 45 | } 46 | } 47 | 48 | if (!function_exists('WriteLogAudit')){ 49 | function WriteLogAudit($status){ 50 | $sampleCode = basename(__FILE__, '.php'); 51 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 52 | } 53 | } 54 | 55 | if(!defined('DO_NOT_RUN_SAMPLES')){ 56 | echo "\nCreateReportSubscription Sample Code is Running..." . PHP_EOL; 57 | CreateReportSubscription(); 58 | } 59 | ?> 60 | -------------------------------------------------------------------------------- /Samples/Reporting/ReportSubscriptions/DeleteSubscriptionOfReportNameByOrganization.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\ReportSubscriptionsApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->deleteSubscription($reportName, $organizationId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | echo "\nDeleteSubscriptionOfReportNameByOrganization Sample Code is Running..." . PHP_EOL; 41 | DeleteSubscriptionOfReportNameByOrganization(); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /Samples/Reporting/ReportSubscriptions/GetAllSubscriptions.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\ReportSubscriptionsApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->getAllSubscriptions($organizationId); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | 21 | WriteLogAudit($apiResponse[1]); 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')){ 39 | echo "\nGetAllSubscriptions Sample Code is Running..." . PHP_EOL; 40 | GetAllSubscriptions(); 41 | } 42 | ?> 43 | -------------------------------------------------------------------------------- /Samples/Reporting/ReportSubscriptions/GetSubscriptionForReportName.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\ReportSubscriptionsApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->getSubscription($reportName, $organizationId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | echo "\nGetSubscriptionForReportName Sample Code is Running..." . PHP_EOL; 41 | GetSubscriptionForReportName(); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /Samples/Reporting/Reports/CreateAdhocReport.php: -------------------------------------------------------------------------------- 1 | true, 14 | "fieldNameConvention" => "SOAPI" 15 | ]; 16 | $reportPreferences = new CyberSource\Model\Reportingv3reportsReportPreferences($reportPreferencesArr); 17 | 18 | $requestObjArr = [ 19 | "reportDefinitionName" => "TransactionRequestClass", 20 | "reportFields" => $reportFields, 21 | "reportMimeType" => "application/xml", 22 | "reportName" => "testrest_v2", 23 | "timezone" => "GMT", 24 | "reportStartTime" => "2024-03-01T17:30:00.000+05:30", 25 | "reportEndTime" => "2024-03-02T17:30:00.000+05:30", 26 | "reportPreferences" => $reportPreferences 27 | ]; 28 | $requestObj = new CyberSource\Model\CreateAdhocReportRequest($requestObjArr); 29 | 30 | $organizationId = "testrest"; 31 | 32 | $commonElement = new CyberSource\ExternalConfiguration(); 33 | $config = $commonElement->ConnectionHost(); 34 | $merchantConfig = $commonElement->merchantConfigObject(); 35 | 36 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 37 | $api_instance = new CyberSource\Api\ReportsApi($api_client); 38 | 39 | try { 40 | $apiResponse = $api_instance->createReport($requestObj, $organizationId); 41 | print_r(PHP_EOL); 42 | print_r($apiResponse); 43 | 44 | WriteLogAudit($apiResponse[1]); 45 | return $apiResponse; 46 | } catch (Cybersource\ApiException $e) { 47 | print_r($e->getResponseBody()); 48 | print_r($e->getMessage()); 49 | $errorCode = $e->getCode(); 50 | WriteLogAudit($errorCode); 51 | } 52 | } 53 | 54 | if (!function_exists('WriteLogAudit')){ 55 | function WriteLogAudit($status){ 56 | $sampleCode = basename(__FILE__, '.php'); 57 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 58 | } 59 | } 60 | 61 | if(!defined('DO_NOT_RUN_SAMPLES')){ 62 | echo "\nCreateAdhocReport Sample Code is Running..." . PHP_EOL; 63 | CreateAdhocReport(); 64 | } 65 | ?> 66 | -------------------------------------------------------------------------------- /Samples/Reporting/Reports/GetReportBasedOnReportId.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\ReportsApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->getReportByReportId($reportId, $organizationId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | echo "\nGetReportBasedOnReportId Sample Code is Running..." . PHP_EOL; 41 | GetReportBasedOnReportId(); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /Samples/Reporting/Reports/RetrieveAvailableReports.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 19 | $merchantConfig = $commonElement->merchantConfigObject(); 20 | 21 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 22 | $api_instance = new CyberSource\Api\ReportsApi($api_client); 23 | 24 | try { 25 | $apiResponse = $api_instance->searchReports($startTime, $endTime, $timeQueryType, $organizationId, $reportMimeType, $reportFrequency, $reportName, $reportDefinitionId, $reportStatus); 26 | print_r(PHP_EOL); 27 | print_r($apiResponse); 28 | 29 | WriteLogAudit($apiResponse[1]); 30 | return $apiResponse; 31 | } catch (Cybersource\ApiException $e) { 32 | print_r($e->getResponseBody()); 33 | print_r($e->getMessage()); 34 | $errorCode = $e->getCode(); 35 | WriteLogAudit($errorCode); 36 | } 37 | } 38 | 39 | if (!function_exists('WriteLogAudit')){ 40 | function WriteLogAudit($status){ 41 | $sampleCode = basename(__FILE__, '.php'); 42 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 43 | } 44 | } 45 | 46 | if(!defined('DO_NOT_RUN_SAMPLES')){ 47 | echo "\nRetrieveAvailableReports Sample Code is Running..." . PHP_EOL; 48 | RetrieveAvailableReports(); 49 | } 50 | ?> 51 | -------------------------------------------------------------------------------- /Samples/Reporting/RetrievalDetails/GetRetrievalDetails.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $apiClient = new CyberSource\ApiClient($config, $merchantConfig); 17 | $apiInstance = new CyberSource\Api\RetrievalDetailsApi($apiClient); 18 | 19 | try { 20 | $apiResponse = $apiInstance->getRetrievalDetails($startTime, $endTime, $organizationId); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if (!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nGetRetrievalDetails Sample Code is Running..." . PHP_EOL; 43 | GetRetrievalDetails(); 44 | } -------------------------------------------------------------------------------- /Samples/Reporting/RetrievalSummaries/GetRetrievalSummaries.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $apiClient = new CyberSource\ApiClient($config, $merchantConfig); 17 | $apiInstance = new CyberSource\Api\RetrievalSummariesApi($apiClient); 18 | 19 | try { 20 | $apiResponse = $apiInstance->getRetrievalSummary($startTime, $endTime, $organizationId); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if (!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nGetRetrievalSummaries Sample Code is Running..." . PHP_EOL; 43 | GetRetrievalSummaries(); 44 | } -------------------------------------------------------------------------------- /Samples/RiskManagement/DecisionManager/RemoveFromHistory.php: -------------------------------------------------------------------------------- 1 | "Adding this transaction as suspect", 11 | "reason" => "suspected", 12 | "action" => "hide" 13 | ]; 14 | $riskInformationMarkingDetails = new CyberSource\Model\Riskv1decisionsidmarkingRiskInformationMarkingDetails($riskInformationMarkingDetailsArr); 15 | 16 | $riskInformationArr = [ 17 | "markingDetails" => $riskInformationMarkingDetails 18 | ]; 19 | $riskInformation = new CyberSource\Model\Riskv1decisionsidmarkingRiskInformation($riskInformationArr); 20 | 21 | $requestObjArr = [ 22 | "riskInformation" => $riskInformation 23 | ]; 24 | $requestObj = new CyberSource\Model\FraudMarkingActionRequest($requestObjArr); 25 | 26 | 27 | $commonElement = new CyberSource\ExternalConfiguration(); 28 | $config = $commonElement->ConnectionHost(); 29 | $merchantConfig = $commonElement->merchantConfigObject(); 30 | 31 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 32 | $api_instance = new CyberSource\Api\DecisionManagerApi($api_client); 33 | 34 | try { 35 | $apiResponse = $api_instance->fraudUpdate($id, $requestObj); 36 | print_r(PHP_EOL); 37 | print_r($apiResponse); 38 | 39 | WriteLogAudit($apiResponse[1]); 40 | return $apiResponse; 41 | } catch (Cybersource\ApiException $e) { 42 | print_r($e->getResponseBody()); 43 | print_r($e->getMessage()); 44 | $errorCode = $e->getCode(); 45 | WriteLogAudit($errorCode); 46 | } 47 | } 48 | 49 | if (!function_exists('WriteLogAudit')){ 50 | function WriteLogAudit($status){ 51 | $sampleCode = basename(__FILE__, '.php'); 52 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 53 | } 54 | } 55 | 56 | if(!defined('DO_NOT_RUN_SAMPLES')){ 57 | echo "\nRemoveFromHistory Sample Code is Running..." . PHP_EOL; 58 | RemoveFromHistory(); 59 | } 60 | ?> 61 | -------------------------------------------------------------------------------- /Samples/SecureFileShare/DownloadFileWithFileIdentifier.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\SecureFileShareApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->getFile($fileId, $organizationId); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | $download_data = $apiResponse[0]; 23 | $file_path = $commonElement->downloadReport($download_data, "DownloadedFileByFileIdentifier.xml"); 24 | echo "File downloaded in the location: \n" . $file_path . "\n"; 25 | WriteLogAudit($apiResponse[1]); 26 | return $apiResponse; 27 | } catch (Cybersource\ApiException $e) { 28 | print_r($e->getResponseBody()); 29 | print_r($e->getMessage()); 30 | $errorCode = $e->getCode(); 31 | WriteLogAudit($errorCode); 32 | } 33 | } 34 | 35 | if (!function_exists('WriteLogAudit')){ 36 | function WriteLogAudit($status){ 37 | $sampleCode = basename(__FILE__, '.php'); 38 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 39 | } 40 | } 41 | 42 | if(!defined('DO_NOT_RUN_SAMPLES')){ 43 | echo "\nDownloadFileWithFileIdentifier Sample Code is Running..." . PHP_EOL; 44 | DownloadFileWithFileIdentifier(); 45 | } 46 | ?> 47 | -------------------------------------------------------------------------------- /Samples/SecureFileShare/GetListOfFiles.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\SecureFileShareApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->getFileDetail($startDate, $endDate, $organizationId, $name); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nGetListOfFiles Sample Code is Running..." . PHP_EOL; 43 | GetListOfFiles(); 44 | } 45 | ?> 46 | -------------------------------------------------------------------------------- /Samples/TokenManagement/Customer/CreateCustomer.php: -------------------------------------------------------------------------------- 1 | "Your customer identifier", 9 | "email" => "test@cybs.com" 10 | ]; 11 | $buyerInformation = new CyberSource\Model\Tmsv2customersBuyerInformation($buyerInformationArr); 12 | 13 | $clientReferenceInformationArr = [ 14 | "code" => "TC50171_3" 15 | ]; 16 | $clientReferenceInformation = new CyberSource\Model\Tmsv2customersClientReferenceInformation($clientReferenceInformationArr); 17 | 18 | $merchantDefinedInformation = array(); 19 | $merchantDefinedInformation_0 = [ 20 | "name" => "data1", 21 | "value" => "Your customer data" 22 | ]; 23 | $merchantDefinedInformation[0] = new CyberSource\Model\Tmsv2customersMerchantDefinedInformation($merchantDefinedInformation_0); 24 | 25 | $requestObjArr = [ 26 | "buyerInformation" => $buyerInformation, 27 | "clientReferenceInformation" => $clientReferenceInformation, 28 | "merchantDefinedInformation" => $merchantDefinedInformation 29 | ]; 30 | $requestObj = new CyberSource\Model\PostCustomerRequest($requestObjArr); 31 | 32 | 33 | $commonElement = new CyberSource\ExternalConfiguration(); 34 | $config = $commonElement->ConnectionHost(); 35 | $merchantConfig = $commonElement->merchantConfigObject(); 36 | 37 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 38 | $api_instance = new CyberSource\Api\CustomerApi($api_client); 39 | 40 | try { 41 | $apiResponse = $api_instance->postCustomer($requestObj, null); 42 | print_r(PHP_EOL); 43 | print_r($apiResponse); 44 | 45 | WriteLogAudit($apiResponse[1]); 46 | return $apiResponse; 47 | } catch (Cybersource\ApiException $e) { 48 | print_r($e->getResponseBody()); 49 | print_r($e->getMessage()); 50 | $errorCode = $e->getCode(); 51 | WriteLogAudit($errorCode); 52 | } 53 | } 54 | 55 | if (!function_exists('WriteLogAudit')){ 56 | function WriteLogAudit($status){ 57 | $sampleCode = basename(__FILE__, '.php'); 58 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 59 | } 60 | } 61 | 62 | if(!defined('DO_NOT_RUN_SAMPLES')){ 63 | CreateCustomer(); 64 | } 65 | ?> 66 | -------------------------------------------------------------------------------- /Samples/TokenManagement/Customer/DeleteCustomer.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\CustomerApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->deleteCustomer($customerTokenId, null); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | 21 | WriteLogAudit($apiResponse[1]); 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')){ 39 | DeleteCustomer(); 40 | } 41 | ?> 42 | -------------------------------------------------------------------------------- /Samples/TokenManagement/Customer/RetrieveCustomer.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 10 | $merchantConfig = $commonElement->merchantConfigObject(); 11 | 12 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 13 | $api_instance = new CyberSource\Api\CustomerApi($api_client); 14 | 15 | try { 16 | $apiResponse = $api_instance->getCustomer($customerTokenId, null); 17 | print_r(PHP_EOL); 18 | print_r($apiResponse); 19 | 20 | WriteLogAudit($apiResponse[1]); 21 | return $apiResponse; 22 | } catch (Cybersource\ApiException $e) { 23 | print_r($e->getResponseBody()); 24 | print_r($e->getMessage()); 25 | $errorCode = $e->getCode(); 26 | WriteLogAudit($errorCode); 27 | } 28 | } 29 | 30 | if (!function_exists('WriteLogAudit')){ 31 | function WriteLogAudit($status){ 32 | $sampleCode = basename(__FILE__, '.php'); 33 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 34 | } 35 | } 36 | 37 | if(!defined('DO_NOT_RUN_SAMPLES')){ 38 | RetrieveCustomer(); 39 | } 40 | ?> 41 | -------------------------------------------------------------------------------- /Samples/TokenManagement/Customer/UpdateCustomersDefaultPaymentInstrument.php: -------------------------------------------------------------------------------- 1 | "AB6A54B982A6FCB6E05341588E0A3935" 10 | ]; 11 | $defaultPaymentInstrument = new CyberSource\Model\Tmsv2customersDefaultPaymentInstrument($defaultPaymentInstrumentArr); 12 | 13 | $requestObjArr = [ 14 | "defaultPaymentInstrument" => $defaultPaymentInstrument 15 | ]; 16 | $requestObj = new CyberSource\Model\PatchCustomerRequest($requestObjArr); 17 | 18 | 19 | $commonElement = new CyberSource\ExternalConfiguration(); 20 | $config = $commonElement->ConnectionHost(); 21 | $merchantConfig = $commonElement->merchantConfigObject(); 22 | 23 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 24 | $api_instance = new CyberSource\Api\CustomerApi($api_client); 25 | 26 | try { 27 | $apiResponse = $api_instance->patchCustomer($customerTokenId, $requestObj, null, null); 28 | print_r(PHP_EOL); 29 | print_r($apiResponse); 30 | 31 | WriteLogAudit($apiResponse[1]); 32 | return $apiResponse; 33 | } catch (Cybersource\ApiException $e) { 34 | print_r($e->getResponseBody()); 35 | print_r($e->getMessage()); 36 | $errorCode = $e->getCode(); 37 | WriteLogAudit($errorCode); 38 | } 39 | } 40 | 41 | if (!function_exists('WriteLogAudit')){ 42 | function WriteLogAudit($status){ 43 | $sampleCode = basename(__FILE__, '.php'); 44 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 45 | } 46 | } 47 | 48 | if(!defined('DO_NOT_RUN_SAMPLES')){ 49 | UpdateCustomersDefaultPaymentInstrument(); 50 | } 51 | ?> 52 | -------------------------------------------------------------------------------- /Samples/TokenManagement/Customer/UpdateCustomersDefaultShippingAddress.php: -------------------------------------------------------------------------------- 1 | "AB6A54B97C00FCB6E05341588E0A3935" 10 | ]; 11 | $defaultShippingAddress = new CyberSource\Model\Tmsv2customersDefaultShippingAddress($defaultShippingAddressArr); 12 | 13 | $requestObjArr = [ 14 | "defaultShippingAddress" => $defaultShippingAddress 15 | ]; 16 | $requestObj = new CyberSource\Model\PatchCustomerRequest($requestObjArr); 17 | 18 | 19 | $commonElement = new CyberSource\ExternalConfiguration(); 20 | $config = $commonElement->ConnectionHost(); 21 | $merchantConfig = $commonElement->merchantConfigObject(); 22 | 23 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 24 | $api_instance = new CyberSource\Api\CustomerApi($api_client); 25 | 26 | try { 27 | $apiResponse = $api_instance->patchCustomer($customerTokenId, $requestObj, null, null); 28 | print_r(PHP_EOL); 29 | print_r($apiResponse); 30 | 31 | WriteLogAudit($apiResponse[1]); 32 | return $apiResponse; 33 | } catch (Cybersource\ApiException $e) { 34 | print_r($e->getResponseBody()); 35 | print_r($e->getMessage()); 36 | $errorCode = $e->getCode(); 37 | WriteLogAudit($errorCode); 38 | } 39 | } 40 | 41 | if (!function_exists('WriteLogAudit')){ 42 | function WriteLogAudit($status){ 43 | $sampleCode = basename(__FILE__, '.php'); 44 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 45 | } 46 | } 47 | 48 | if(!defined('DO_NOT_RUN_SAMPLES')){ 49 | UpdateCustomersDefaultShippingAddress(); 50 | } 51 | ?> 52 | -------------------------------------------------------------------------------- /Samples/TokenManagement/CustomerPaymentInstrument/DeleteCustomerPaymentInstrument.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\CustomerPaymentInstrumentApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->deleteCustomerPaymentInstrument($customerTokenId, $paymentInstrumentTokenId, null); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | DeleteCustomerPaymentInstrument(); 41 | } 42 | ?> 43 | -------------------------------------------------------------------------------- /Samples/TokenManagement/CustomerPaymentInstrument/ListPaymentInstrumentsForCustomer.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\CustomerPaymentInstrumentApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->getCustomerPaymentInstrumentsList($customerTokenId, $profileid, $offset, $limit); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')){ 42 | ListPaymentInstrumentsForCustomer(); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /Samples/TokenManagement/CustomerPaymentInstrument/RetrieveCustomerPaymentInstrument.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\CustomerPaymentInstrumentApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->getCustomerPaymentInstrument($customerTokenId, $paymentInstrumentTokenId, null); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | 21 | WriteLogAudit($apiResponse[1]); 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')){ 39 | RetrieveCustomerPaymentInstrument(); 40 | } 41 | ?> 42 | -------------------------------------------------------------------------------- /Samples/TokenManagement/CustomerShippingAddress/CreateCustomerDefaultShippingAddress.php: -------------------------------------------------------------------------------- 1 | "John", 10 | "lastName" => "Doe", 11 | "company" => "CyberSource", 12 | "address1" => "1 Market St", 13 | "locality" => "San Francisco", 14 | "administrativeArea" => "CA", 15 | "postalCode" => "94105", 16 | "country" => "US", 17 | "email" => "test@cybs.com", 18 | "phoneNumber" => "4158880000" 19 | ]; 20 | $shipTo = new CyberSource\Model\Tmsv2customersEmbeddedDefaultShippingAddressShipTo($shipToArr); 21 | 22 | $requestObjArr = [ 23 | "_default" => true, 24 | "shipTo" => $shipTo 25 | ]; 26 | $requestObj = new CyberSource\Model\PostCustomerShippingAddressRequest($requestObjArr); 27 | 28 | 29 | $commonElement = new CyberSource\ExternalConfiguration(); 30 | $config = $commonElement->ConnectionHost(); 31 | $merchantConfig = $commonElement->merchantConfigObject(); 32 | 33 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 34 | $api_instance = new CyberSource\Api\CustomerShippingAddressApi($api_client); 35 | 36 | try { 37 | $apiResponse = $api_instance->postCustomerShippingAddress($customerTokenId, $requestObj, null); 38 | print_r(PHP_EOL); 39 | print_r($apiResponse); 40 | 41 | WriteLogAudit($apiResponse[1]); 42 | return $apiResponse; 43 | } catch (Cybersource\ApiException $e) { 44 | print_r($e->getResponseBody()); 45 | print_r($e->getMessage()); 46 | $errorCode = $e->getCode(); 47 | WriteLogAudit($errorCode); 48 | } 49 | } 50 | 51 | if (!function_exists('WriteLogAudit')){ 52 | function WriteLogAudit($status){ 53 | $sampleCode = basename(__FILE__, '.php'); 54 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 55 | } 56 | } 57 | 58 | if(!defined('DO_NOT_RUN_SAMPLES')){ 59 | CreateCustomerDefaultShippingAddress(); 60 | } 61 | ?> 62 | -------------------------------------------------------------------------------- /Samples/TokenManagement/CustomerShippingAddress/CreateCustomerNonDefaultShippingAddress.php: -------------------------------------------------------------------------------- 1 | "John", 10 | "lastName" => "Doe", 11 | "company" => "CyberSource", 12 | "address1" => "1 Market St", 13 | "locality" => "San Francisco", 14 | "administrativeArea" => "CA", 15 | "postalCode" => "94105", 16 | "country" => "US", 17 | "email" => "test@cybs.com", 18 | "phoneNumber" => "4158880000" 19 | ]; 20 | $shipTo = new CyberSource\Model\Tmsv2customersEmbeddedDefaultShippingAddressShipTo($shipToArr); 21 | 22 | $requestObjArr = [ 23 | "_default" => false, 24 | "shipTo" => $shipTo 25 | ]; 26 | $requestObj = new CyberSource\Model\PostCustomerShippingAddressRequest($requestObjArr); 27 | 28 | 29 | $commonElement = new CyberSource\ExternalConfiguration(); 30 | $config = $commonElement->ConnectionHost(); 31 | $merchantConfig = $commonElement->merchantConfigObject(); 32 | 33 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 34 | $api_instance = new CyberSource\Api\CustomerShippingAddressApi($api_client); 35 | 36 | try { 37 | $apiResponse = $api_instance->postCustomerShippingAddress($customerTokenId, $requestObj, null); 38 | print_r(PHP_EOL); 39 | print_r($apiResponse); 40 | 41 | WriteLogAudit($apiResponse[1]); 42 | return $apiResponse; 43 | } catch (Cybersource\ApiException $e) { 44 | print_r($e->getResponseBody()); 45 | print_r($e->getMessage()); 46 | $errorCode = $e->getCode(); 47 | WriteLogAudit($errorCode); 48 | } 49 | } 50 | 51 | if (!function_exists('WriteLogAudit')){ 52 | function WriteLogAudit($status){ 53 | $sampleCode = basename(__FILE__, '.php'); 54 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 55 | } 56 | } 57 | 58 | if(!defined('DO_NOT_RUN_SAMPLES')){ 59 | CreateCustomerNonDefaultShippingAddress(); 60 | } 61 | ?> 62 | -------------------------------------------------------------------------------- /Samples/TokenManagement/CustomerShippingAddress/DeleteCustomerShippingAddress.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\CustomerShippingAddressApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->deleteCustomerShippingAddress($customerTokenId, $shippingAddressTokenId, null); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | DeleteCustomerShippingAddress(); 41 | } 42 | ?> 43 | -------------------------------------------------------------------------------- /Samples/TokenManagement/CustomerShippingAddress/ListShippingAddressesForCustomer.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\CustomerShippingAddressApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->getCustomerShippingAddressesList($customerTokenId, $profileid, $offset, $limit); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')){ 42 | ListShippingAddressesForCustomer(); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /Samples/TokenManagement/CustomerShippingAddress/RetrieveCustomerShippingAddress.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\CustomerShippingAddressApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->getCustomerShippingAddress($customerTokenId, $shippingAddressTokenId, null); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | 21 | WriteLogAudit($apiResponse[1]); 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')){ 39 | RetrieveCustomerShippingAddress(); 40 | } 41 | ?> 42 | -------------------------------------------------------------------------------- /Samples/TokenManagement/InstrumentIdentifier/CreateInstrumentIdentifierBankAccount.php: -------------------------------------------------------------------------------- 1 | "4100", 11 | "routingNumber" => "071923284" 12 | ]; 13 | $bankAccount = new CyberSource\Model\TmsEmbeddedInstrumentIdentifierBankAccount($bankAccountArr); 14 | 15 | $requestObjArr = [ 16 | "bankAccount" => $bankAccount 17 | ]; 18 | $requestObj = new CyberSource\Model\PostInstrumentIdentifierRequest($requestObjArr); 19 | 20 | 21 | $commonElement = new CyberSource\ExternalConfiguration(); 22 | $config = $commonElement->ConnectionHost(); 23 | $merchantConfig = $commonElement->merchantConfigObject(); 24 | 25 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 26 | $api_instance = new CyberSource\Api\InstrumentIdentifierApi($api_client); 27 | 28 | try { 29 | $apiResponse = $api_instance->postInstrumentIdentifier($requestObj, $profileid); 30 | print_r(PHP_EOL); 31 | print_r($apiResponse); 32 | 33 | WriteLogAudit($apiResponse[1]); 34 | return $apiResponse; 35 | } catch (Cybersource\ApiException $e) { 36 | print_r($e->getResponseBody()); 37 | print_r($e->getMessage()); 38 | $errorCode = $e->getCode(); 39 | WriteLogAudit($errorCode); 40 | } 41 | } 42 | 43 | if (!function_exists('WriteLogAudit')){ 44 | function WriteLogAudit($status){ 45 | $sampleCode = basename(__FILE__, '.php'); 46 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 47 | } 48 | } 49 | 50 | if(!defined('DO_NOT_RUN_SAMPLES')){ 51 | echo "\nCreateInstrumentIdentifierBankAccount Sample Code is Running..." . PHP_EOL; 52 | CreateInstrumentIdentifierBankAccount(); 53 | } 54 | ?> 55 | -------------------------------------------------------------------------------- /Samples/TokenManagement/InstrumentIdentifier/CreateInstrumentIdentifierCard.php: -------------------------------------------------------------------------------- 1 | "4111111111111111" 11 | ]; 12 | $card = new CyberSource\Model\TmsEmbeddedInstrumentIdentifierCard($cardArr); 13 | 14 | $requestObjArr = [ 15 | "card" => $card 16 | ]; 17 | $requestObj = new CyberSource\Model\PostInstrumentIdentifierRequest($requestObjArr); 18 | 19 | $commonElement = new CyberSource\ExternalConfiguration(); 20 | $config = $commonElement->ConnectionHost(); 21 | $merchantConfig = $commonElement->merchantConfigObject(); 22 | 23 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 24 | $api_instance = new CyberSource\Api\InstrumentIdentifierApi($api_client); 25 | 26 | try { 27 | $apiResponse = $api_instance->postInstrumentIdentifier($requestObj, $profileid); 28 | print_r(PHP_EOL); 29 | print_r($apiResponse); 30 | 31 | WriteLogAudit($apiResponse[1]); 32 | return $apiResponse; 33 | } catch (Cybersource\ApiException $e) { 34 | print_r($e->getResponseBody()); 35 | print_r($e->getMessage()); 36 | $errorCode = $e->getCode(); 37 | WriteLogAudit($errorCode); 38 | } 39 | } 40 | 41 | if (!function_exists('WriteLogAudit')){ 42 | function WriteLogAudit($status){ 43 | $sampleCode = basename(__FILE__, '.php'); 44 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 45 | } 46 | } 47 | 48 | if(!defined('DO_NOT_RUN_SAMPLES')){ 49 | echo "\nCreateInstrumentIdentifierCard Sample Code is Running..." . PHP_EOL; 50 | CreateInstrumentIdentifierCard(); 51 | } 52 | ?> 53 | -------------------------------------------------------------------------------- /Samples/TokenManagement/InstrumentIdentifier/DeleteInstrumentIdentifier.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 13 | $merchantConfig = $commonElement->merchantConfigObject(); 14 | 15 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 16 | $api_instance = new CyberSource\Api\InstrumentIdentifierApi($api_client); 17 | 18 | try { 19 | $apiResponse = $api_instance->deleteInstrumentIdentifier($tokenId, $profileid); 20 | print_r(PHP_EOL); 21 | print_r($apiResponse); 22 | 23 | WriteLogAudit($apiResponse[1]); 24 | return $apiResponse; 25 | } catch (Cybersource\ApiException $e) { 26 | print_r($e->getResponseBody()); 27 | print_r($e->getMessage()); 28 | $errorCode = $e->getCode(); 29 | WriteLogAudit($errorCode); 30 | } 31 | } 32 | 33 | if (!function_exists('WriteLogAudit')){ 34 | function WriteLogAudit($status){ 35 | $sampleCode = basename(__FILE__, '.php'); 36 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 37 | } 38 | } 39 | 40 | if(!defined('DO_NOT_RUN_SAMPLES')){ 41 | echo "\nDeleteInstrumentIdentifier Sample Code is Running..." . PHP_EOL; 42 | DeleteInstrumentIdentifier(); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /Samples/TokenManagement/InstrumentIdentifier/ListPaymentInstrumentsForInstrumentIdentifier.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\InstrumentIdentifierApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->getInstrumentIdentifierPaymentInstrumentsList($instrumentIdentifierTokenId, $profileid, false, $offset, $limit); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')){ 42 | ListPaymentInstrumentsForInstrumentIdentifier(); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /Samples/TokenManagement/InstrumentIdentifier/RetrieveInstrumentIdentifier.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\InstrumentIdentifierApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->getInstrumentIdentifier($tokenId, $profileid); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | echo "\nRetrieveInstrumentIdentifier Sample Code is Running..." . PHP_EOL; 41 | RetrieveInstrumentIdentifier(); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /Samples/TokenManagement/PaymentInstrument/DeletePaymentInstrument.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 13 | $merchantConfig = $commonElement->merchantConfigObject(); 14 | 15 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 16 | $api_instance = new CyberSource\Api\PaymentInstrumentApi($api_client); 17 | 18 | try { 19 | $apiResponse = $api_instance->deletePaymentInstrument($tokenId, $profileid); 20 | print_r(PHP_EOL); 21 | print_r($apiResponse); 22 | 23 | WriteLogAudit($apiResponse[1]); 24 | return $apiResponse; 25 | } catch (Cybersource\ApiException $e) { 26 | print_r($e->getResponseBody()); 27 | print_r($e->getMessage()); 28 | $errorCode = $e->getCode(); 29 | WriteLogAudit($errorCode); 30 | } 31 | } 32 | 33 | if (!function_exists('WriteLogAudit')){ 34 | function WriteLogAudit($status){ 35 | $sampleCode = basename(__FILE__, '.php'); 36 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 37 | } 38 | } 39 | 40 | if(!defined('DO_NOT_RUN_SAMPLES')){ 41 | echo "\nDeletePaymentInstrument Sample Code is Running..." . PHP_EOL; 42 | DeletePaymentInstrument(); 43 | } 44 | ?> 45 | -------------------------------------------------------------------------------- /Samples/TokenManagement/PaymentInstrument/RetrievePaymentInstrument.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\PaymentInstrumentApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->getPaymentInstrument($tokenId, $profileid); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | echo "\nRetrievePaymentInstrument Sample Code is Running..." . PHP_EOL; 41 | RetrievePaymentInstrument(); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /Samples/TransactionBatches/GetIndividualBatchFile.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 11 | $merchantConfig = $commonElement->merchantConfigObject(); 12 | 13 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 14 | $api_instance = new CyberSource\Api\TransactionBatchesApi($api_client); 15 | 16 | try { 17 | $apiResponse = $api_instance->getTransactionBatchId($id); 18 | print_r(PHP_EOL); 19 | print_r($apiResponse); 20 | 21 | WriteLogAudit($apiResponse[1]); 22 | return $apiResponse; 23 | } catch (Cybersource\ApiException $e) { 24 | print_r($e->getResponseBody()); 25 | print_r($e->getMessage()); 26 | $errorCode = $e->getCode(); 27 | WriteLogAudit($errorCode); 28 | } 29 | } 30 | 31 | if (!function_exists('WriteLogAudit')){ 32 | function WriteLogAudit($status){ 33 | $sampleCode = basename(__FILE__, '.php'); 34 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 35 | } 36 | } 37 | 38 | if(!defined('DO_NOT_RUN_SAMPLES')){ 39 | echo "\nGetIndividualBatchFile Sample Code is Running..." . PHP_EOL; 40 | GetIndividualBatchFile(); 41 | } 42 | ?> 43 | -------------------------------------------------------------------------------- /Samples/TransactionBatches/GetListOfBatchFiles.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 12 | $merchantConfig = $commonElement->merchantConfigObject(); 13 | 14 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 15 | $api_instance = new CyberSource\Api\TransactionBatchesApi($api_client); 16 | 17 | try { 18 | $apiResponse = $api_instance->getTransactionBatches($startTime, $endTime); 19 | print_r(PHP_EOL); 20 | print_r($apiResponse); 21 | 22 | WriteLogAudit($apiResponse[1]); 23 | return $apiResponse; 24 | } catch (Cybersource\ApiException $e) { 25 | print_r($e->getResponseBody()); 26 | print_r($e->getMessage()); 27 | $errorCode = $e->getCode(); 28 | WriteLogAudit($errorCode); 29 | } 30 | } 31 | 32 | if (!function_exists('WriteLogAudit')){ 33 | function WriteLogAudit($status){ 34 | $sampleCode = basename(__FILE__, '.php'); 35 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 36 | } 37 | } 38 | 39 | if(!defined('DO_NOT_RUN_SAMPLES')){ 40 | echo "\nGetListOfBatchFiles Sample Code is Running..." . PHP_EOL; 41 | GetListOfBatchFiles(); 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /Samples/TransactionBatches/GetTransactionDetailsForGivenBatchId.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 13 | $merchantConfig = $commonElement->merchantConfigObject(); 14 | 15 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 16 | $api_instance = new CyberSource\Api\TransactionBatchesApi($api_client); 17 | 18 | try { 19 | $apiResponse = $api_instance->getTransactionBatchDetails($id, $uploadDate, $status); 20 | print_r(PHP_EOL); 21 | print_r($apiResponse); 22 | 23 | $download_data = $apiResponse[0]; 24 | $file_path = $commonElement->downloadReport($download_data, "BatchDetails.xml"); 25 | echo "File downloaded in the location: \n" . $file_path . "\n"; 26 | WriteLogAudit($apiResponse[1]); 27 | return $apiResponse; 28 | } catch (Cybersource\ApiException $e) { 29 | print_r($e->getResponseBody()); 30 | print_r($e->getMessage()); 31 | $errorCode = $e->getCode(); 32 | WriteLogAudit($errorCode); 33 | } 34 | } 35 | 36 | if (!function_exists('WriteLogAudit')){ 37 | function WriteLogAudit($status){ 38 | $sampleCode = basename(__FILE__, '.php'); 39 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 40 | } 41 | } 42 | 43 | if(!defined('DO_NOT_RUN_SAMPLES')){ 44 | echo "\nGetTransactionDetailsForGivenBatchId Sample Code is Running..." . PHP_EOL; 45 | GetTransactionDetailsForGivenBatchId(); 46 | } 47 | ?> 48 | -------------------------------------------------------------------------------- /Samples/TransactionDetails/RetrieveTransaction.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\TransactionDetailsApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->getTransaction($id); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nRetrieveTransaction Sample Code is Running..." . PHP_EOL; 43 | RetrieveTransaction(); 44 | } 45 | ?> 46 | -------------------------------------------------------------------------------- /Samples/TransactionSearch/CreateSearchRequest.php: -------------------------------------------------------------------------------- 1 | false, 9 | "name" => "MRN", 10 | "timezone" => "America/Chicago", 11 | "query" => "clientReferenceInformation.code:TC50171_3 AND submitTimeUtc:[NOW/DAY-7DAYS TO NOW/DAY+1DAY}", 12 | "offset" => 0, 13 | "limit" => 100, 14 | "sort" => "id:asc,submitTimeUtc:asc" 15 | ]; 16 | $requestObj = new CyberSource\Model\CreateSearchRequest($requestObjArr); 17 | 18 | 19 | $commonElement = new CyberSource\ExternalConfiguration(); 20 | $config = $commonElement->ConnectionHost(); 21 | $merchantConfig = $commonElement->merchantConfigObject(); 22 | 23 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 24 | $api_instance = new CyberSource\Api\SearchTransactionsApi($api_client); 25 | 26 | try { 27 | $apiResponse = $api_instance->createSearch($requestObj); 28 | print_r(PHP_EOL); 29 | print_r($apiResponse); 30 | 31 | WriteLogAudit($apiResponse[1]); 32 | return $apiResponse; 33 | } catch (Cybersource\ApiException $e) { 34 | print_r($e->getResponseBody()); 35 | print_r($e->getMessage()); 36 | $errorCode = $e->getCode(); 37 | WriteLogAudit($errorCode); 38 | } 39 | } 40 | 41 | if (!function_exists('WriteLogAudit')){ 42 | function WriteLogAudit($status){ 43 | $sampleCode = basename(__FILE__, '.php'); 44 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 45 | } 46 | } 47 | 48 | if(!defined('DO_NOT_RUN_SAMPLES')){ 49 | echo "\nCreateSearchRequest Sample Code is Running..." . PHP_EOL; 50 | CreateSearchRequest(); 51 | } 52 | ?> 53 | -------------------------------------------------------------------------------- /Samples/TransactionSearch/GetSearchResults.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\SearchTransactionsApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->getSearch($searchId); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nGetSearchResults Sample Code is Running..." . PHP_EOL; 43 | GetSearchResults(); 44 | } 45 | ?> 46 | -------------------------------------------------------------------------------- /Samples/UserManagement/UserManagement/GetUserInformationDeprecated.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | $api_instance = new CyberSource\Api\UserManagementApi($api_client); 18 | 19 | try { 20 | $apiResponse = $api_instance->getUsers($organizationId, $userName, $permissionId, $roleId); 21 | print_r(PHP_EOL); 22 | print_r($apiResponse); 23 | 24 | WriteLogAudit($apiResponse[1]); 25 | return $apiResponse; 26 | } catch (Cybersource\ApiException $e) { 27 | print_r($e->getResponseBody()); 28 | print_r($e->getMessage()); 29 | $errorCode = $e->getCode(); 30 | WriteLogAudit($errorCode); 31 | } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')){ 42 | echo "\nGetUserInformationDeprecated Sample Code is Running..." . PHP_EOL; 43 | GetUserInformationDeprecated(); 44 | } 45 | ?> 46 | -------------------------------------------------------------------------------- /Samples/ValueAddedService/VoidCommittedTaxCall.php: -------------------------------------------------------------------------------- 1 | "TAX_TC001" 11 | ]; 12 | $clientReferenceInformation = new CyberSource\Model\Vasv2taxidClientReferenceInformation($clientReferenceInformationArr); 13 | 14 | $requestObjArr = [ 15 | "clientReferenceInformation" => $clientReferenceInformation 16 | ]; 17 | $requestObj = new CyberSource\Model\VoidTaxRequest($requestObjArr); 18 | 19 | 20 | $commonElement = new CyberSource\ExternalConfiguration(); 21 | $config = $commonElement->ConnectionHost(); 22 | $merchantConfig = $commonElement->merchantConfigObject(); 23 | 24 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 25 | $api_instance = new CyberSource\Api\TaxesApi($api_client); 26 | 27 | try { 28 | $apiResponse = $api_instance->voidTax($requestObj, $id); 29 | print_r(PHP_EOL); 30 | print_r($apiResponse); 31 | 32 | WriteLogAudit($apiResponse[1]); 33 | return $apiResponse; 34 | } catch (Cybersource\ApiException $e) { 35 | print_r($e->getResponseBody()); 36 | print_r($e->getMessage()); 37 | $errorCode = $e->getCode(); 38 | WriteLogAudit($errorCode); 39 | } 40 | } 41 | 42 | if (!function_exists('WriteLogAudit')){ 43 | function WriteLogAudit($status){ 44 | $sampleCode = basename(__FILE__, '.php'); 45 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 46 | } 47 | } 48 | 49 | if(!defined('DO_NOT_RUN_SAMPLES')){ 50 | VoidCommittedTaxCall(); 51 | } 52 | ?> 53 | -------------------------------------------------------------------------------- /Samples/Webhooks/CreateNewWebhooks/CreateWebhookSymmetricKey.php: -------------------------------------------------------------------------------- 1 | "nrtd", 9 | "tenant" => "", 10 | "keyType" => "sharedSecret", 11 | "organizationId" => "" 12 | ]; 13 | $keyInformation = new CyberSource\Model\Kmsegressv2keyssymKeyInformation($keyInformationArr); 14 | 15 | $requestObjArr = [ 16 | "clientRequestAction" => "CREATE", 17 | "keyInformation" => $keyInformation 18 | ]; 19 | $requestObj = new CyberSource\Model\SaveSymEgressKey($requestObjArr); 20 | 21 | 22 | $commonElement = new CyberSource\ExternalConfiguration(); 23 | $config = $commonElement->ConnectionHost(); 24 | $merchantConfig = $commonElement->merchantConfigObject(); 25 | 26 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 27 | $api_instance = new CyberSource\Api\CreateNewWebhooksApi($api_client); 28 | 29 | try { 30 | $apiResponse = $api_instance->saveSymEgressKey($vCsenderOrganizationId, $vCpermissions, $vCcorrelationId, $requestObj); 31 | print_r(PHP_EOL); 32 | print_r($apiResponse); 33 | WriteLogAudit($apiResponse[1]); 34 | 35 | return $apiResponse; 36 | } catch (Cybersource\ApiException $e) { 37 | print_r($e->getResponseBody()); 38 | print_r($e->getMessage()); 39 | $errorCode = $e->getCode(); 40 | WriteLogAudit($errorCode); 41 | } 42 | } 43 | 44 | if (!function_exists('WriteLogAudit')){ 45 | function WriteLogAudit($status){ 46 | $sampleCode = basename(__FILE__, '.php'); 47 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 48 | } 49 | } 50 | 51 | if(!defined('DO_NOT_RUN_SAMPLES')) { 52 | echo "\nCreateWebhookSymmetricKey Sample Code is Running..." . PHP_EOL; 53 | CreateWebhookSymmetricKey($vCcorrelationId, $vCsenderOrganizationId, $vCpermissions); 54 | } 55 | ?> -------------------------------------------------------------------------------- /Samples/Webhooks/CreateNewWebhooks/FindProductsYouCanSubscribeTo.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 10 | // $merchantConfig = $commonElement->merchantConfigObject(); 11 | 12 | // $api_client = new CyberSource\ApiClient($config, $merchantConfig); 13 | // $api_instance = new CyberSource\Api\CreateNewWebhooksApi($api_client); 14 | 15 | // try { 16 | // $apiResponse = $api_instance->findProductsToSubscribe($organizationId); 17 | // print_r(PHP_EOL); 18 | // print_r($apiResponse); 19 | // WriteLogAudit($apiResponse[1]); 20 | 21 | // return $apiResponse; 22 | // } catch (Cybersource\ApiException $e) { 23 | // print_r($e->getResponseBody()); 24 | // print_r($e->getMessage()); 25 | // $errorCode = $e->getCode(); 26 | // WriteLogAudit($errorCode); 27 | // } 28 | } 29 | 30 | if (!function_exists('WriteLogAudit')){ 31 | function WriteLogAudit($status){ 32 | $sampleCode = basename(__FILE__, '.php'); 33 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 34 | } 35 | } 36 | 37 | if(!defined('DO_NOT_RUN_SAMPLES')) { 38 | echo "\nFindProductsYouCanSubscribeTo Sample Code is Running..." . PHP_EOL; 39 | FindProductsYouCanSubscribeTo($organizationId); 40 | } 41 | ?> -------------------------------------------------------------------------------- /Samples/Webhooks/CreateNewWebhooks/StoreOAuthCredentials.php: -------------------------------------------------------------------------------- 1 | "", 9 | "tenant" => "nrtd", 10 | "keyType" => "oAuthClientCredentials", 11 | "organizationId" => "", 12 | "clientKeyId" => "client username", 13 | "key" => "client secret", 14 | "expiryDuration" => "365" 15 | ]; 16 | $keyInformation = new CyberSource\Model\Kmsegressv2keyssymKeyInformation($keyInformationArr); 17 | 18 | $requestObjArr = [ 19 | "clientRequestAction" => "STORE", 20 | "keyInformation" => $keyInformation 21 | ]; 22 | $requestObj = new CyberSource\Model\SaveSymEgressKey($requestObjArr); 23 | 24 | 25 | $commonElement = new CyberSource\ExternalConfiguration(); 26 | $config = $commonElement->ConnectionHost(); 27 | $merchantConfig = $commonElement->merchantConfigObject(); 28 | 29 | $api_client = new CyberSource\ApiClient($config, $merchantConfig); 30 | $api_instance = new CyberSource\Api\CreateNewWebhooksApi($api_client); 31 | 32 | try { 33 | $apiResponse = $api_instance->saveSymEgressKey($vCsenderOrganizationId, $vCpermissions, $vCcorrelationId, $requestObj); 34 | print_r(PHP_EOL); 35 | print_r($apiResponse); 36 | WriteLogAudit($apiResponse[1]); 37 | 38 | return $apiResponse; 39 | } catch (Cybersource\ApiException $e) { 40 | print_r($e->getResponseBody()); 41 | print_r($e->getMessage()); 42 | $errorCode = $e->getCode(); 43 | WriteLogAudit($errorCode); 44 | } 45 | } 46 | 47 | if (!function_exists('WriteLogAudit')){ 48 | function WriteLogAudit($status){ 49 | $sampleCode = basename(__FILE__, '.php'); 50 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 51 | } 52 | } 53 | 54 | if(!defined('DO_NOT_RUN_SAMPLES')) { 55 | echo "\nStoreOAuthCredentials Sample Code is Running..." . PHP_EOL; 56 | StoreOAuthCredentials($vCcorrelationId, $vCsenderOrganizationId, $vCpermissions); 57 | } 58 | ?> -------------------------------------------------------------------------------- /Samples/Webhooks/ManageWebhooks/DeleteWebhookSubscription.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 10 | // $merchantConfig = $commonElement->merchantConfigObject(); 11 | 12 | // $api_client = new CyberSource\ApiClient($config, $merchantConfig); 13 | // $api_instance = new CyberSource\Api\ManageWebhooksApi($api_client); 14 | 15 | // try { 16 | // $apiResponse = $api_instance->deleteWebhookSubscription($webhookId); 17 | // print_r(PHP_EOL); 18 | // print_r($apiResponse); 19 | // WriteLogAudit($apiResponse[1]); 20 | 21 | // return $apiResponse; 22 | // } catch (Cybersource\ApiException $e) { 23 | // print_r($e->getResponseBody()); 24 | // print_r($e->getMessage()); 25 | // $errorCode = $e->getCode(); 26 | // WriteLogAudit($errorCode); 27 | // } 28 | } 29 | 30 | if (!function_exists('WriteLogAudit')){ 31 | function WriteLogAudit($status){ 32 | $sampleCode = basename(__FILE__, '.php'); 33 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 34 | } 35 | } 36 | 37 | if(!defined('DO_NOT_RUN_SAMPLES')) { 38 | echo "\nDeleteWebhookSubscription Sample Code is Running..." . PHP_EOL; 39 | DeleteWebhookSubscription($webhookId); 40 | } 41 | ?> -------------------------------------------------------------------------------- /Samples/Webhooks/ManageWebhooks/GetDetailsOnAllCreatedWebhooks.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 14 | // $merchantConfig = $commonElement->merchantConfigObject(); 15 | 16 | // $api_client = new CyberSource\ApiClient($config, $merchantConfig); 17 | // $api_instance = new CyberSource\Api\ManageWebhooksApi($api_client); 18 | 19 | // try { 20 | // $apiResponse = $api_instance->getWebhookSubscriptionsByOrg($organizationId, $productId, $eventType); 21 | // print_r(PHP_EOL); 22 | // print_r($apiResponse); 23 | // WriteLogAudit($apiResponse[1]); 24 | 25 | // return $apiResponse; 26 | // } catch (Cybersource\ApiException $e) { 27 | // print_r($e->getResponseBody()); 28 | // print_r($e->getMessage()); 29 | // $errorCode = $e->getCode(); 30 | // WriteLogAudit($errorCode); 31 | // } 32 | } 33 | 34 | if (!function_exists('WriteLogAudit')){ 35 | function WriteLogAudit($status){ 36 | $sampleCode = basename(__FILE__, '.php'); 37 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 38 | } 39 | } 40 | 41 | if(!defined('DO_NOT_RUN_SAMPLES')) { 42 | echo "\nGetDetailsOnAllCreatedWebhooks Sample Code is Running..." . PHP_EOL; 43 | GetDetailsOnAllCreatedWebhooks(); 44 | } 45 | ?> -------------------------------------------------------------------------------- /Samples/Webhooks/ManageWebhooks/GetDetailsOnSingleWebhook.php: -------------------------------------------------------------------------------- 1 | ConnectionHost(); 10 | // $merchantConfig = $commonElement->merchantConfigObject(); 11 | 12 | // $api_client = new CyberSource\ApiClient($config, $merchantConfig); 13 | // $api_instance = new CyberSource\Api\ManageWebhooksApi($api_client); 14 | 15 | // try { 16 | // $apiResponse = $api_instance->getWebhookSubscriptionById($webhookId); 17 | // print_r(PHP_EOL); 18 | // print_r($apiResponse); 19 | // WriteLogAudit($apiResponse[1]); 20 | 21 | // return $apiResponse; 22 | // } catch (Cybersource\ApiException $e) { 23 | // print_r($e->getResponseBody()); 24 | // print_r($e->getMessage()); 25 | // $errorCode = $e->getCode(); 26 | // WriteLogAudit($errorCode); 27 | // } 28 | } 29 | 30 | if (!function_exists('WriteLogAudit')){ 31 | function WriteLogAudit($status){ 32 | $sampleCode = basename(__FILE__, '.php'); 33 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 34 | } 35 | } 36 | 37 | if(!defined('DO_NOT_RUN_SAMPLES')) { 38 | echo "\nGetDetailsOnSingleWebhook Sample Code is Running..." . PHP_EOL; 39 | GetDetailsOnSingleWebhook($webhookId); 40 | } 41 | ?> -------------------------------------------------------------------------------- /Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsBySetStartAndEndTime.php: -------------------------------------------------------------------------------- 1 | "FAILED", 9 | // "startTime" => "2021-01-01T15:05:52.284+05:30", 10 | // "endTime" => "2021-01-02T03:05:52.284+05:30", 11 | // "productId" => "tokenManagement", 12 | // "eventType" => "tms.token.created" 13 | // ]; 14 | // $byDeliveryStatus = new CyberSource\Model\Nrtfv1webhookswebhookIdreplaysByDeliveryStatus($byDeliveryStatusArr); 15 | 16 | // $requestObjArr = [ 17 | // "byDeliveryStatus" => $byDeliveryStatus 18 | // ]; 19 | // $requestObj = new CyberSource\Model\ReplayWebhooksRequest($requestObjArr); 20 | 21 | 22 | // $commonElement = new CyberSource\ExternalConfiguration(); 23 | // $config = $commonElement->ConnectionHost(); 24 | // $merchantConfig = $commonElement->merchantConfigObject(); 25 | 26 | // $api_client = new CyberSource\ApiClient($config, $merchantConfig); 27 | // $api_instance = new CyberSource\Api\ManageWebhooksApi($api_client); 28 | 29 | // try { 30 | // $apiResponse = $api_instance->replayPreviousWebhooks($webhookId, $requestObj); 31 | // print_r(PHP_EOL); 32 | // print_r($apiResponse); 33 | // WriteLogAudit($apiResponse[1]); 34 | 35 | // return $apiResponse; 36 | // } catch (Cybersource\ApiException $e) { 37 | // print_r($e->getResponseBody()); 38 | // print_r($e->getMessage()); 39 | // $errorCode = $e->getCode(); 40 | // WriteLogAudit($errorCode); 41 | // } 42 | } 43 | 44 | if (!function_exists('WriteLogAudit')){ 45 | function WriteLogAudit($status){ 46 | $sampleCode = basename(__FILE__, '.php'); 47 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 48 | } 49 | } 50 | 51 | if(!defined('DO_NOT_RUN_SAMPLES')) { 52 | echo "\nReplayFailedTransactionsBySetStartAndEndTime Sample Code is Running..." . PHP_EOL; 53 | ReplayFailedTransactionsBySetStartAndEndTime($webhookId); 54 | } 55 | ?> -------------------------------------------------------------------------------- /Samples/Webhooks/ManageWebhooks/ReplayFailedTransactionsInLast24Hours.php: -------------------------------------------------------------------------------- 1 | "FAILED", 9 | // "hoursBack" => 24, 10 | // "productId" => "tokenManagement", 11 | // "eventType" => "tms.token.created" 12 | // ]; 13 | // $byDeliveryStatus = new CyberSource\Model\Nrtfv1webhookswebhookIdreplaysByDeliveryStatus($byDeliveryStatusArr); 14 | 15 | // $requestObjArr = [ 16 | // "byDeliveryStatus" => $byDeliveryStatus 17 | // ]; 18 | // $requestObj = new CyberSource\Model\ReplayWebhooksRequest($requestObjArr); 19 | 20 | 21 | // $commonElement = new CyberSource\ExternalConfiguration(); 22 | // $config = $commonElement->ConnectionHost(); 23 | // $merchantConfig = $commonElement->merchantConfigObject(); 24 | 25 | // $api_client = new CyberSource\ApiClient($config, $merchantConfig); 26 | // $api_instance = new CyberSource\Api\ManageWebhooksApi($api_client); 27 | 28 | // try { 29 | // $apiResponse = $api_instance->replayPreviousWebhooks($webhookId, $requestObj); 30 | // print_r(PHP_EOL); 31 | // print_r($apiResponse); 32 | // WriteLogAudit($apiResponse[1]); 33 | 34 | // return $apiResponse; 35 | // } catch (Cybersource\ApiException $e) { 36 | // print_r($e->getResponseBody()); 37 | // print_r($e->getMessage()); 38 | // $errorCode = $e->getCode(); 39 | // WriteLogAudit($errorCode); 40 | // } 41 | } 42 | 43 | if (!function_exists('WriteLogAudit')){ 44 | function WriteLogAudit($status){ 45 | $sampleCode = basename(__FILE__, '.php'); 46 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 47 | } 48 | } 49 | 50 | if(!defined('DO_NOT_RUN_SAMPLES')) { 51 | echo "\nReplayFailedTransactionsInLast24Hours Sample Code is Running..." . PHP_EOL; 52 | ReplayFailedTransactionsInLast24Hours($webhookId); 53 | } 54 | ?> -------------------------------------------------------------------------------- /Samples/Webhooks/ManageWebhooks/ReplaySpecificListOfTransactions.php: -------------------------------------------------------------------------------- 1 | $byTransactionTraceIdentifiers 15 | // ]; 16 | // $requestObj = new CyberSource\Model\ReplayWebhooksRequest($requestObjArr); 17 | 18 | 19 | // $commonElement = new CyberSource\ExternalConfiguration(); 20 | // $config = $commonElement->ConnectionHost(); 21 | // $merchantConfig = $commonElement->merchantConfigObject(); 22 | 23 | // $api_client = new CyberSource\ApiClient($config, $merchantConfig); 24 | // $api_instance = new CyberSource\Api\ManageWebhooksApi($api_client); 25 | 26 | // try { 27 | // $apiResponse = $api_instance->replayPreviousWebhooks($webhookId, $requestObj); 28 | // print_r(PHP_EOL); 29 | // print_r($apiResponse); 30 | // WriteLogAudit($apiResponse[1]); 31 | 32 | // return $apiResponse; 33 | // } catch (Cybersource\ApiException $e) { 34 | // print_r($e->getResponseBody()); 35 | // print_r($e->getMessage()); 36 | // $errorCode = $e->getCode(); 37 | // WriteLogAudit($errorCode); 38 | // } 39 | } 40 | 41 | if (!function_exists('WriteLogAudit')){ 42 | function WriteLogAudit($status){ 43 | $sampleCode = basename(__FILE__, '.php'); 44 | print_r("\n[Sample Code Testing] [$sampleCode] $status"); 45 | } 46 | } 47 | 48 | if(!defined('DO_NOT_RUN_SAMPLES')) { 49 | echo "\nReplaySpecificListOfTransactions Sample Code is Running..." . PHP_EOL; 50 | ReplaySpecificListOfTransactions($webhookId); 51 | } 52 | ?> -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cybersource/samplecodes", 3 | "version": "0.0.1", 4 | "description": "Sample code for REST api", 5 | "keywords": [ 6 | "Authentication", 7 | "cybersource", 8 | "payments", 9 | "ecommerce", 10 | "samplecodes", 11 | "restapisamples" 12 | ], 13 | "homepage": "https://github.com/CyberSource/", 14 | "license": "proprietary", 15 | "authors": [ 16 | { 17 | "name": "Visa developer", 18 | "homepage": "https://github.com/CyberSource/cybersource-rest-samples-php" 19 | } 20 | ], 21 | "require": { 22 | "php": ">=8.0.0", 23 | "cybersource/rest-client-php": "0.0.62", 24 | "firebase/php-jwt": "^6.0.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/SampleApiClient/connection/connection.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/SampleApiClient/controller/apiController.php: -------------------------------------------------------------------------------- 1 | getAuthenticationType(); 21 | 22 | $exception = new ApiException(); 23 | $messageAuthType = " [INFO]: ".GlobalParameter::REQTYPE ."=>".$method; 24 | $exception->setExceptionLog($merchantConfig, $messageAuthType); 25 | $exceptionMsg = GlobalParameter::LOG_END_MSG; 26 | if($authType==GlobalParameter::HTTP_SIGNATURE) 27 | { 28 | 29 | $callHttp = new HttpService(); 30 | $callHttpData = $callHttp->httpService($method, $payloadData, $resourcePath, $merchantConfig); 31 | $exception->setExceptionLog($merchantConfig, $exceptionMsg); 32 | return $callHttpData; 33 | 34 | } 35 | else if($authType==GlobalParameter::JWT) 36 | { 37 | 38 | $callJwt = new JwtService(); 39 | $callJwtData = $callJwt->jwtService($method, $payloadData, $resourcePath, $merchantConfig); 40 | $exception->setExceptionLog($merchantConfig, $exceptionMsg); 41 | return $callJwtData; 42 | 43 | } 44 | else 45 | { 46 | $error_message = GlobalParameter::AUTH_ERROR; 47 | $exception = new ApiException($error_message, 0, null, null); 48 | $exception->setExceptionLog($merchantConfig, $exception); 49 | throw $exception; 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /lib/SampleApiClient/masking/maskingController.php: -------------------------------------------------------------------------------- 1 | "XXXXX","expirationMonth"=>"XXXX","expirationYear"=>"XXXX","email"=>"XXXXX","firstName"=>"XXXXX","lastName"=>"XXXX","phoneNumber"=>"XXXXX","type"=>"XXXX","securityCode"=>"XXXXX"); 12 | $postData_json = json_decode($postData_json, JSON_UNESCAPED_SLASHES); 13 | $postData_json = $this->dataMaskingIterate($postData_json, $toBeMask); 14 | return json_encode($postData_json); 15 | } 16 | 17 | //Data masking iteration 18 | public function dataMaskingIterate($responceArr, $callback) 19 | { 20 | if(!empty($responceArr)){ 21 | foreach ($responceArr as $k => $v) 22 | { 23 | if(is_array($v)) { 24 | $responceArr[$k] = $this->dataMaskingIterate($v, $callback); 25 | } 26 | else 27 | { 28 | if(array_key_exists($k, $callback)) 29 | { 30 | $responceArr[$k]="XXXXXX"; 31 | } 32 | } 33 | } 34 | } 35 | return $responceArr; 36 | 37 | } 38 | 39 | } 40 | 41 | 42 | ?> -------------------------------------------------------------------------------- /lib/SampleApiClient/services/httpService.php: -------------------------------------------------------------------------------- 1 | generateToken($resourceUrl, $payload, $method, $merchantConfig); 20 | $conn = new HttpConnection(); 21 | $data = $conn->getConnection($getToken, $resourceUrl, $payload, $method, $merchantConfig); 22 | return $data; 23 | 24 | } 25 | } 26 | 27 | ?> -------------------------------------------------------------------------------- /lib/SampleApiClient/services/jwtService.php: -------------------------------------------------------------------------------- 1 | getToken($resourceUrl, $payload, $method, $merchantConfig); 14 | $conn = new JwtUrlConnection(); 15 | $data = $conn->getConnection($getToken, $resourceUrl, $payload, $method, $merchantConfig); 16 | return $data; 17 | } 18 | } 19 | ?> -------------------------------------------------------------------------------- /lib/SampleApiClient/sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=Python 2 | sonar.projectName=cybersource_authentication_sdk_python 3 | sonar.projectVersion=1.0.0 4 | sonar.sources=test,cybs 5 | sonar.language=py 6 | sonar.python.coverage.reportPath=target/coverage.xml 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sample_code_ignore_list.txt: -------------------------------------------------------------------------------- 1 | .*Webhooks.* 2 | .*MerchantBoarding.* 3 | .*BulkBoarding.* 4 | -------------------------------------------------------------------------------- /sample_code_runner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | FILECOUNT=0 3 | SAMPLECOUNT=1 4 | find Samples -print | grep -i -e "\.php$" > list.txt 5 | 6 | echo > output.log 7 | 8 | set -e 9 | while IFS="" read -r p || [ -n "$p" ] 10 | do 11 | if [[ "$p" =~ $(echo ^\($(sed 's/[[:blank:]]//g' sample_code_ignore_list.txt | paste -sd '|' /dev/stdin)\)$) ]]; then 12 | printf '\n\n#### SKIPPED - %s ####\n' "$p" 13 | printf '\n\n#### SKIPPED - %s ####\n' "$p" >> output.log 14 | else 15 | printf '\n\n**** RUNNING - %s ****\n' "$p" 16 | printf '\n\n%s **** RUNNING - %s ****\n' "$SAMPLECOUNT" "$p" >> output.log 17 | php "$p" >> output.log 18 | printf '\n\n**** END RUNNING - %s ****\n' "$p" >> output.log 19 | FILECOUNT=$((FILECOUNT+1)) 20 | fi 21 | 22 | SAMPLECOUNT=$((SAMPLECOUNT+1)) 23 | done < list.txt 24 | printf '\n\n**** %s Sample Codes ran successfully ****\n' "$SAMPLECOUNT" 25 | printf '\n\n**** %s Sample Codes ran successfully ****\n' "$FILECOUNT" >> output.log 26 | rm -f list.txt --------------------------------------------------------------------------------