This document is a complete reference for the features of the Salt Technology Client Library API. The SALT Client Libraries allow you to integrate your website with the SALT payment platform.
If you are not using one of the SALT Client Libraries, please refer to the POST API reference documentation instead.
The singlePurchase
method runs a one-time charge against a credit card.
singlePurchase(orderId, creditCard, amount, verificationRequest)
|
||
Name | Type | Description |
---|---|---|
orderId |
String(32) |
Merchant assigned order identifier. Must be unique. |
creditCard |
CreditCard |
The credit card to be charged |
amount |
Long |
Amount of the purchase in cents. Do NOT include a $ or any decimal place. (e.g. if your purchase is $10.00, then send 1000 as the total). |
verificationRequest |
VerificationRequest |
Credit Card Verification request information, null if not used. See Section 5 for details on how to use this field. |
Returns: | ||
CreditCardReceipt |
The results of the purchase request |
CreditCardReceipt receipt = httpsCreditCardService.singlePurchase(orderId, creditCard, 1000, verificationRequest); //10 dollars transactionId = receipt.getTransactionId();
$service->singlePurchase($transactionId, $creditCard, '100', $vr);
receipt = service.singlePurchase("order-124", creditCard, "200", vr)
CreditCardReceipt receipt = httpsCreditCardService.singlePurchase(orderId, creditCard, 1000, verificationRequest); //10 dollars transactionId = receipt.getTransactionId();
Cancels a transaction, preventing it from being settled. A Void can only be performed on a transaction belonging to the current batch, before the current batch is closed (i.e. before the end of day).
voidTransaction(transactionId, transactionOrderId)
|
||
Name | Type | Description |
---|---|---|
transactionId |
Long |
The SALT transactionId of the transaction to void |
transactionOrderId |
String(32) |
The orderId previously assigned to the transaction that is to be voided. This is an extra check to prevent inadvertent voiding of a transaction. Not null. |
Returns: | ||
CreditCardReceipt |
The results of the void request |
httpsCreditCardService.voidTransaction(transactionId, orderId);
$service->voidTransaction($transactionId, $orderId);
receipt = service.singlePurchase(transactionId, orderId)
httpsCreditCardService.voidTransaction(transactionId, orderId);
Returns funds from a previously settled purchase to the customer. Refunds can only be performed on a purchase that is part of an already-closed batch.
refund(purchaseId, purchaseOrderId, refundOrderId, amount) |
||
Name | Type | Description |
---|---|---|
purchaseId |
Long |
The SALT transactionId of the purchase to refund |
purchaseOrderId |
String(32) |
The order id previously assigned to the purchase that is to be refunded. This is an extra check to prevent inadvertent refunding of a purchase. Not null. |
refundOrderId |
String(32) |
The merchant assigned orderId to be attached to this refund request. Will be generated if null. |
amount |
Long |
Amount to refund in cents. Do NOT include a $ or any decimal place. (e.g. if your purchase is $10.00, then send 1000 as the total). This value does NOT have to match the original purchase amount. |
Returns: | ||
CreditCardReceipt |
The results of the Refund Request |
httpsCreditCardService.refund(transactionId, orderId, refundOrderId, 1000); //10 dollars
$receipt = $service->refund($purchaseId,$orderId, $refundOrderId, $purchaseAmount);
httpsCreditCardService.refund(transactionId, orderId, refundOrderId, 1000); //10 dollars
In certain cases when you are unsure of the results of the transaction, such as when a transaction times out, you may need to double-check its status. You can run the verifyTransaction()
method to perform this check. This method returns a receipt containing the results of the original transaction.
verifyTransaction(transactionId, transactionOrderId) |
||
Name | Type | Description |
---|---|---|
transactionId |
Long |
The SALT transactionId of the transaction to verify |
transactionOrderId |
String(32) |
The orderId assigned to the transaction. |
Returns: | ||
CreditCardReceipt |
The results of the transaction verification request |
You must specify at least one of the transactionId
or transactionOrderId
arguments.
Note that if the specified transaction cannot be found, you will receive a not-found C111_TRANSACTION_DOES_NOT_EXIST
error in the receipt, as opposed to
the results of the transaction.
httpsCreditCardService.verifyTransaction(transactionId, orderId);
$service->verifyTransaction($transactionId, $orderId)
service.verifyTransaction(transactionId, orderId)
httpsCreditCardService.verifyTransaction(transactionId, orderId);
Use the verifyCreditCard()
method to check the validity of a credit card without charging the customer (i.e. a $0.00 transaction). A CreditCardReceipt
object is returned, containing information about the card
validity, Secure Storage information if the card uses Secure Storage and Fraud information if the card uses the Advanced Fraud Suite.
verifyCreditCard(creditCard, verificationRequest) |
||
Name | Type | Description |
---|---|---|
creditCard |
CreditCard |
Credit Card information (see Table 3.4) |
verificationRequest |
Verification Request |
Credit Card Verification request information, null if not used. See Section 5 for details on how to use this field. |
Returns: | ||
CreditCardReceipt |
The results of the verifyCreditCard request. (See Table 3.21) |
httpsCreditCardService.verifyCreditCard(creditCard, verificationRequest);
$service->verifyCreditCard($creditCard, $verificationRequest);
service.verifyCreditCard(creditCardSpecifier, verificationRequest)
httpsCreditCardService.verifyCreditCard(creditCard, verificationRequest);
You can use SALT’s Recurring Payments feature when the customer is billed periodically, or when splitting payment into a number of separate payments.
You can set up a customer for recurring billing by using the recurringPurchase()
method:
recurringPurchase(periodicPurchaseInfo, creditCard, storageTokenId, verificationRequest) |
||
Name | Type | Description |
---|---|---|
periodicPurchaseInfo |
PeriodicPurchaseInfo |
Defines periodic-specific information, such as schedule, dates, and customer ID. See Table 3.10. |
creditCard |
CreditCard |
Credit Card information (see Table 3.4). If storageTokenId is provided, this will be ignored |
storageTokenId |
String |
Storage Token ID specifying the stored credit card to use for this purchase. Takes precedence over the creditCard field. |
verificationRequest |
Verification Request |
Credit Card Verification request information, null if not used. Note that CVV2 will not be stored/used in recurring purchases. See Section 5 for details on how to use this field. |
Returns: | ||
CreditCardReceipt |
The results of the purchase request. |
The PeriodicPurchaseInfo
defines setup parameters such as schedule and per-payment-amount for a recurring payment.
The periodicPurchaseInfo
object is constructed as follows:
PeriodicPurchaseInfo Constructor Parameters
|
||
Name | Type | Description |
---|---|---|
periodicTransactionId |
Long |
SALT recurring purchase ID returned when the purchase was originally created. Not applicable to new recurring purchases |
state |
State |
One of IN_PROGRESS, ON_HOLD, CANCELLED. Note a cancelled payment will not be run again and cannot be further modified. Not applicable to new recurring purchases. |
schedule |
Schedule |
The schedule on which to issue payments. See Table 3.11. If null, will default to monthly payments. |
perPaymentAmount |
Long |
Per-payment amount of the in cents. Do NOT include a $ or any decimal place. (e.g. if your purchase is $10.00, then send 1000 as the total). |
orderId |
String(32) |
Merchant assigned orderId. Must be unique. Cannot be modified after the first payment has been issued. |
customerId |
String(32) |
Optional meta field that can be used to describe a customer |
startDate |
Date |
The date of when to issue the first payment. If this date is null or in the past, then the first payment will be issued immediately. Cannot be modified after the first payment has been issued. |
endDate |
Date |
The date of when to end the payments. A payment will not be issued if it falls on this date. |
nextPaymentDate |
Date |
Change when the next payment will occur. Must be set between the start and end date (as currently defined or as modified by their respective parameters). Not used in a new recurring payment (startDate defines first payment date). |
Parameters Outside of the full constructor | ||
ExecutionType |
enum |
Has a value of either
If not provided, will default to |
setExecutionType(ExecutionType executionType) |
Sets the execution type to either manual or auto | |
getExecutionType() |
ExecutionType |
Returns the value of the execution type |
installmentNumber |
Integer |
The value of the instalment the periodic purchase transaction is on. (e.g. if there are 4 instalments, and the card is charged for the second time, the installmentNumber = 2) |
setInstallmentNumber(Integer installmentNumber) |
||
getInstallmentNumber() |
Integer |
Returns the installmentNumber |
Used to define a schedule for when to issue recurring payments:
Schedule Constructor Parameters |
||
Name | Type | Description |
---|---|---|
scheduleType |
ScheduleType |
Schedule based on days, weeks, or months (See the ScheduleType Enumeration below) |
intervalLength |
Short |
Payments will be issued every number of days/weeks/months |
ScheduleType Enumeration |
|
Value | Description |
---|---|
MONTH | Schedule based on months |
WEEK | Schedule based on weeks |
DAY | Schedule based on days |
So for example, if you create a Schedule using scheduleType = WEEK and intervalLength = 2, then payments will be issued every two weeks.
If you created a recurring purchase with a MANUAL execution mode, to charge the customer card you will need to call the executeRecurringPurchase()
method.
executeRecurringPurchase(recurringPurchaseId, cvv2) |
||
Name | Type | Description |
---|---|---|
recurringPurchaseId |
Long |
SALT recurring purchase ID returned when the purchase was originally created. |
cvv2 |
String |
Card Verification Value/Card Verification Digits. This parameter provides optional verification when performing this transaction |
Returns: | ||
CreditCardReceipt |
The results of the transaction |
There are additional operations available that you can use to manage your recurring payments.
Putting a hold on a recurring payment means that further payments will be suspended until the recurring payment is resumed. You can resume payments by
calling the resumeRecurringPurchase()
method.
holdRecurringPurchase(recurringPurchaseId) |
||
Name | Type | Description |
---|---|---|
recurringPurchaseId |
Long |
SALT recurring purchase ID returned when the purchase was originally created. |
Returns: | ||
CreditCardReceipt |
The results of the hold |
resumeRecurringPurchase(recurringPurchaseId) |
||
Name | Type | Description |
---|---|---|
recurringPurchaseId |
Long |
SALT recurring purchase ID returned when the purchase was originally created. |
Returns: | ||
CreditCardReceipt |
The results of the hold |
You can cancel a payment entirely by calling the cancelRecurringPurchase()
method. This means that no further payments will be made regardless of whether
the payment has reached its endDate
. Note that you cannot resume or otherwise update a cancelled payment.
cancelRecurringPurchase(recurringPurchaseId) |
||
Name | Type | Description |
---|---|---|
recurringPurchaseId |
Long |
SALT recurring purchase ID returned when the purchase was originally created. |
Returns: | ||
CreditCardReceipt |
The results of the cancellation |
To update the payment details of a recurring purchase such as when a customer credit card expires/is changed, you can use the updateRecurringPurchase()
method. Note that you cannot update a recurring purchase that has been cancelled or that has completed.
If any parameters provided are null, the existing corresponding fields will not be updated.
updateRecurringPurchase(periodicPurchaseInfo, creditCard, storageTokenId, verificationRequest) |
||
Name | Type | Description |
---|---|---|
periodicPurchaseInfo |
PeriodicPurchaseInfo |
Defines periodic-specific information, such as schedule, dates, and customer ID. See Table 3.10. |
creditCard |
CreditCard |
Credit Card information (see Table 3.4). If storageTokenId is provided, this will be ignored |
storageTokenId |
String(32) |
Storage Token ID specifying the stored credit card to use for this purchase. Takes precedence over the creditCard field. |
verificationRequest |
VerificationRequest |
Credit Card Verification request information, null if not used. Note that CVV2 will not be stored/used in recurring purchases. See Section 5 for details on how to use this field. |
Returns: | ||
CreditCardReceipt |
The results of the update request |
The queryRecurringPurchase()
method is a convenience method that you can use to check the current status of a recurring purchase, including the last
successful payment made.
queryRecurringPurchase(recurringPurchaseId) |
||
Name | Type | Description |
---|---|---|
recurringPurchaseId |
Long |
SALT recurring purchase ID returned when the purchase was originally created. |
Returns: | ||
CreditCardReceipt |
The results of the query retrieve the PeriodicPurchaseInfo field for periodic purchase fields. |
The PeriodicPurchaseInfo
object contains a subset of the fields from the class:
periodicTransactionId
the ID when the periodic purchase was originally created
state
current state of the periodic purchase
nextPaymentDate
next date the payment will be run
lastPaymentId
the transaction ID of the last successful payment run. You can use this ID to run a verifyTransaction()
to retrieve the transaction
information.
Schedule schedule = new Schedule(ScheduleType.DAY, (short)5); PeriodicPurchaseInfo info = new PeriodicPurchaseInfo(0L, State.NEW, schedule, 1000L, orderId, "customer id", new Date(), new Date(), new Date()); CreditCardReceipt receipt = httpsCreditCardService.recurringPurchase(info, creditCard, null, verificationRequest); httpsCreditCardService.executeRecurringPurchase(transactionId, "cvv");
// recur schedule (in this example, every 2 weeks) $schedule = new Schedule(WEEK, 2); // Note that date format is 'yymmdd' $receipt = $service->recurringPurchase('recurring-001', $creditCard, '1000', '091010', '091210', $schedule, null);
schedule = Schedule.new($WEEK, 5) periodicPurchaseInfo = PeriodicPurchaseInfo.new(nil, $IN_PROGRESS, schedule, "60000" , "recurring-order 1" ,nil,"111111", "121111") receipt = service.recurringPurchase2(periodicPurchaseInfo, nil, nil)
Schedule schedule = new Schedule(ScheduleType.DAY, (short)5); PeriodicPurchaseInfo info = new PeriodicPurchaseInfo(0L, State.NEW, schedule, 1000L, orderId, "customer id", new Date(), new Date(), new Date()); CreditCardReceipt receipt = httpsCreditCardService.recurringPurchase(info, creditCard, null, verificationRequest); httpsCreditCardService.executeRecurringPurchase(transactionId, "cvv");
All batches are closed automatically every night at 12:00 am EST. If for some reason you want to close a batch manually during the day, this may be done by
invoking the closeBatch()
method. Note that this will NOT prevent the automatic daily batch closure.
HttpsCreditCardService.closeBatch() |
|
Returns: | |
CreditCardReceipt |
The results of the batch close |
CreditCardReceipt receipt = httpsCreditCardService.closeBatch();
$service->closeBatch();
CreditCardReceipt receipt = httpsCreditCardService.closeBatch();
Applies only when using the Advanced Fraud Sute. This function allows you to update fraud service with the appropriate credit card authorization status if you are using a non-SALT payment processing service.
updateFraud(Long transactionId, String fraudSessionId, String auth) |
||
Name | Type | Description |
---|---|---|
transactionId |
Long |
Transaction ID number of the transaction whose fraud authentication is being updated. Cannot be null. |
fraudSessionId |
String |
Fraud Session ID string. Cannot be null. Used to track which merchant is preforming the fraud update. |
auth |
String |
Auth string. If null, will decline the update request. |
Returns: | ||
CreditCardReceipt |
The results of the fraud update |
CreditCardReceipt receipt = httpsCreditCardService.updateFraud(transactionId, fraudSessionId, auth);
CreditCardReceipt receipt = httpsCreditCardService.updateFraud(transactionId, fraudSessionId, auth);
The CreditCardReceipt
object contains the results of a credit card transaction:
CreditCardReceipt | ||
Field | Type | Description |
---|---|---|
getApprovalInfo() |
ApprovalInfo |
Transaction approval information |
getAvsResponse() |
AvsResponse |
The AVS response from processing the purchase, or null if AVS was not enabled or no response. See Section 5 |
getCardBrand() |
Integer |
Returns the brand of the credit card, as a number: 1=Visa, 2=MasterCard, 3=AMEX, 4=Discover, 5=Diners, 6=JCB, 7=Other |
getCvv2Response() |
Cvv2Response |
The CVV2 response from processing the purchase, or null if CVV2 was not enabled or no response. See Section 5 |
getDebugMessage() |
String(255) |
Debug message, if applicable |
getErrorCode() |
String(128) |
Error code, if applicable |
getErrorMessage() |
String(255) |
Error message, if applicable |
getOrderId() |
String(32) |
Merchant-assigned orderId |
getPeriodicPurchaseInfo() |
PeriodicPurchaseInfo |
Information about the periodic purchase, if this was a periodic purchase transaction |
getProcessedDateTime() |
Date |
Date/time when the transaction was processed |
getSanitizedCardNumber() |
String(20) |
Storage/display-safe version of the credit card number. E.g. 424242****4242 |
getTransactionId() |
Long |
SALT TransactionId for this transaction |
isApproved() |
Boolean |
Returns true if the request was approved, otherwise the request was declined due to some error. |
The ApprovalInfo
object contains the transaction approval information of the Transaction:
ApprovalInfo |
||
Field | Type | Description |
---|---|---|
getApprovalCode() |
String |
Credit Card Approval Code |
getAuthorizedAmount() |
Long |
Amount authorized on approval, in cents |
getReferenceNumber() |
Integer |
Credit Card approval Reference Number |
getTraceNumber() |
Integer |
Credit Card approval Trace Number |
With the Secure Storage API, merchants can remotely store credit card and other sensitive customer data with SALT to increase security and reduce the scope of PCI Compliance.
When information is stored with SALT, a Storage Token (which identifies the information in secure storage) is returned in response. This Storage Token can be used for all subsequent transactions including purchases and credit card verification.
HttpsCreditCardService.addToStorage(paymentProfile, storageTokenId)
|
||
Name | Type | Description |
---|---|---|
storageTokenId |
String(32) |
Optional. Specifies the identifier (storage token) for the stored information. Must be unique. If not provided, SALT will auto-generate one for you. |
paymentProfile |
PaymentProfile |
Contains the customer information to be stored. |
Returns: | ||
StorageReceipt |
The results of the storage request |
The PaymentProfile
class contains a CreditCard
data object as well as a CustomerProfile
data object. The basic constructor is shown below.
PaymentProfile Constructor Parameters
|
||
Name | Type | Description |
---|---|---|
creditCard |
CreditCard |
Contains Credit Card information, optional. However, if you intend to run transactions with this PaymentProfile you must provide this field. |
customerProfile |
CustomerProfile |
Contains Customer information, optional. See Table 5.10 for details |
The CreditCard
class is described in Table 5.1. Note that CVV2 will not be stored, even if specified.
The CustomerProfile
class allows you to store various customer details such as name and address. All fields are completely optional you can choose to
store any or all of the following fields:
CustomerProfile
|
||
Field | Type | Description |
---|---|---|
setFirstName() |
String |
Customer first name |
setLastName() |
String |
Customer last name |
setAddress1() |
String |
Address 1 (first line of address) |
setAddress2() |
String |
Address 2 (second line of address) |
setCity() |
String |
City |
setProvince() |
String |
Province/State |
setPostal() |
String |
Postal/ZIP Code |
setCountry() |
String |
Country |
setPhoneNumber() |
String |
Customer Phone Number |
setFaxNumber() |
String |
Customer Fax Number |
setWebsite() |
String |
Customer website |
setLegalName() |
String |
Customer Company Legal Name |
setTradeName() |
String |
Customer Company Trade Name |
The results of the storage request are returned as a StorageReceipt
object. This is a data class similar to the CreditCardReceipt
, and contains the following fields:
StorageReceipt
|
||
Field | Type | Description |
---|---|---|
getDebugMessage() |
String |
Debug message, if applicable |
getErrorCode() |
String |
Error code, if applicable |
getErrorMessage() |
String |
Error message, if applicable |
getProcessedDateTime() |
Date |
Date/time when the transaction was processed |
getPaymentProfile() |
PaymentProfile |
Payment profile retrieved or updates (via the storage query or update methods). For creation/deletion, this field is null |
getStorageTokenId() |
String(32) |
The storageTokenId used. For storage record creation where no storageTokenId was specified, this will contain the value of the SALT-generated storageTokenId. |
isApproved() |
Boolean |
Returns true if the request was approved, otherwise the request was declined due to some error. |
Once you have created a Storage Token, you can use it in place of a CreditCard
object in any transaction that requires a credit card. The SALT Gateway will
use the storageTokenId
to look up the stored credit card information, which in turn will be used in the transaction.
To use the storageTokenId
, all you need to do is call the appropriate Storage Token transaction methods (which are the same as the credit card methods,
just replacing the credit card with the token). The Storage Token singlePurchase()
is shown below:
singlePurchase(orderId, storageTokenId, amount, verificationRequest)
(using Secure Storage)
|
||
Name | Type | Description |
---|---|---|
orderId |
String(32) |
Merchant assigned orderId. Must be unique. |
storageTokenId |
String(32) |
Storage Token ID as returned to you/specified by you when the storage record was created, will specify the stored credit card to use for this purchase. |
amount |
Long |
Amount of the purchase in cents. Do NOT include a $ or any decimal place. (e.g. if your purchase is $10.00, then send 1000 as the total). |
verificationRequest |
Verification Request |
Credit Card Verification request information, null if not used. See Section 5.1 for details on how to use this field. Note that because CVV2 is not stored, you cannot specify a CVV2 check. |
Returns: | ||
CreditCardReceipt
|
The results of the purchase request |
There is a method that can provide the merchant a combined transaction for both purchase and secure storage creation.
HttpsCreditCardService.singlePurchase(orderId, storageTokenId, amount, verificationRequest)
|
||
Name | Type | Description |
---|---|---|
orderId |
String(32) |
Merchant assigned orderId. Must be unique. |
creditCard |
CreditCard |
Credit Card information (see Table 3.4) |
amount |
Long |
Amount of the purchase in cents. Do NOT include a $ or any decimal place. (e.g. if your purchase is $10.00, then send 1000 as the total). |
verificationRequest |
Verification Request |
Credit Card Verification request information, null if not used. See Section 5.1 for details on how to use this field. Note that because CVV2 is not stored, you cannot specify a CVV2 check. |
storageTokenId |
String(32) |
The secure storage token id that will be used to create storage record for this credit card. |
Returns: | ||
CreditCardReceipt
|
The results of the purchase request |
The other methods that can use the storageTokenId
are:
You can query and retrieve the contents of any previously stored customer information.
HttpsCreditCardService.queryStorage(storageTokenId)
|
||
Name | Type | Description |
---|---|---|
storageTokenId |
String(32) |
The Storage Token ID of the stored information to retrieve. |
Returns: | ||
StorageReceipt
|
The results of the query request |
You can access the data through StorageReceipt.getPaymentProfile()
and then retrieving the contained creditCard
and/or customerProfile
.
If you need to update/modify a stored record:
HttpsCreditCardService.updateStorage(storageTokenId, paymentProfile)
|
||
Name | Type | Description |
---|---|---|
storageTokenId |
String(32) |
The Storage Token ID of the stored information to update. |
paymentProfile |
PaymentProfile |
Customer information to be stored. Will overwrite any existing customer information. |
Returns: | ||
StorageReceipt |
The results of the update request |
The provided PaymentProfile
will overwrite any existing data. If a null value is provided for the PaymentProfile
creditCard
or customerProfile
parameters, then the corresponding stored data will be deleted. Note that even if you delete all of the data, the record itself will still exist (but be blank).
If you need to delete a stored record altogether:
HttpsCreditCardService.deleteFromStorage(storageTokenId)
|
||
Name | Type | Description |
---|---|---|
storageTokenId |
String(32) |
The Storage Token ID of the stored information to delete. |
Returns: | ||
StorageReceipt |
The results of the delete request |
Deleting a record will free up the associated storageTokenId
for re-use.
CustomerProfile customerProfile = new CustomerProfile(); customerProfile.setFirstName("firstName"); customerProfile.setLastName("lastName"); customerProfile.setAddress1("address1"); customerProfile.setPostal("postal"); customerProfile.setPhoneNumber("phone"); PaymentProfile paymentProfile = new PaymentProfile(creditCard, customerProfile); StorageReceipt receipt = httpsCreditCardService.addToStorage(storageTokenId, paymentProfile); //make a purchase VerificationRequest verificationRequest = new VerificationRequest(AvsRequest.VERIFY_STREET_AND_ZIP, Cvv2Request.CVV2_PRESENT); httpsCreditCardService.singlePurchase("order id", STORAGE_TOKEN_ID, 1000, verificationRequest); //10 dollars
$merchant = new Merchant ('yourMerchatId', 'yourApiToken'); $service = new HttpsCreditCardService($merchant, $url); // credit card info from customer - to be stored $creditCard = new CreditCard('5555555555554444', '1010', null, '123 Street', 'A1B23C'); // payment profile to be stored (just using the card component in this example) $paymentProfile = new PaymentProfile($creditCard, null); // store data under the token 'my-token-001' $storageToken = 'my-token-001'; $receipt = $service->addToStorage($storageToken, $paymentProfile); // Approved? echo 'Storage Approved: ' . $receipt->isApproved(); // if stored, now use in a purchase if ($receipt->isApproved() != 'false') { // send request $receipt = $service->singlePurchase('stored-card-001', $storageToken, '100', null); }
merchantId = [your merchantId] apiToken = "[your apiToken]" service = HttpsCreditCardService.new(merchantId, apiToken, url) creditCard = CreditCard.new('5555555555554444', '1010', '111', '123 Street', 'A1B23C'); paymentProfile = PaymentProfile.new(creditCard, nil) storageToken = "my-token-010" receipt = service.addToStorage(storageToken, paymentProfile) puts "storage Approved: " + "#{receipt.isApproved()}" response = service.singlePurchase("stored-card-003", storageToken, "100", nil)
CustomerProfile customerProfile = new CustomerProfile(); customerProfile.setFirstName("firstName"); customerProfile.setLastName("lastName"); customerProfile.setAddress1("address1"); customerProfile.setPostal("postal"); customerProfile.setPhoneNumber("phone"); PaymentProfile paymentProfile = new PaymentProfile(creditCard, customerProfile); StorageReceipt receipt = httpsCreditCardService.addToStorage(storageTokenId, paymentProfile); //make a purchase VerificationRequest verificationRequest = new VerificationRequest(AvsRequest.VERIFY_STREET_AND_ZIP, Cvv2Request.CVV2_PRESENT); httpsCreditCardService.singlePurchase("order id", STORAGE_TOKEN_ID, 1000, verificationRequest); //10 dollars