Our Secure Payment Profile service allows merchants to create secure payment accounts — or "profiles" — for storing confidential contact and/or credit details on our server. Transactions can then be processed against these profiles without the need to recollect payment information from the customer. Also, you do not need to store payment information on the merchant’s system. Each profile can store multiple cards.
When you save a payment profile you will be given a customer code ID in return. This ID can be used for retrieving the profile information, updating it, and also for making payments.
Payment Profiles can be created with a plain credit card number, however we recommend that you first tokenize the card data in the client-side application and then use that token to create the profile.
Creating and modifying Secure Payment Profiles requires you use your Profiles API Key. If you get an authentication error you might be using your Payments API Key, so double check!
var profile = {
card:{
name:"Jon Profile",
number:"5100000010001004",
expiry_month:"02",
expiry_year:"19",
cvd:"123"
},
billing: {
name: "Jon Profile",
address_line1: "123 fake street",
city: "victoria",
province: "bc",
postal_code: "V9A3Z4",
country: "ca",
email_address: "fake@example.com",
phone_number:"12345678"
}
};
beanstream.profiles.createProfile(profile)
.then(function(response){
// success
})
.catch(function(error){
console.log(error);
});
$profile_create = array(
'billing' => array(
'name' => 'Profile Billing Name',
'email_address' => 'email@email.com',
'phone_number' => '1234567890',
'address_line1' => '456-123 Billing St.',
'city' => 'Shippingville',
'province' => 'BC',
'postal_code' => 'V8J9I5',
'country' => 'CA'
),
'card' => array(
'name' => 'John Doe',
'number' => '4030000010001234',
'expiry_month' => '07',
'expiry_year' => '22',
'cvd' => '123'
)
);
$profile_id = $beanstream->profiles()->createProfile($profile_create);
profile = Beanstream.ProfilesAPI.getCreateProfileWithCardTemplate()
profile[:card][:name] = "Bob Test"
profile[:card][:number] = "4030000010001234"
profile[:card][:expiry_month] ="07"
profile[:card][:expiry_year] = "22"
profile[:card][:cvd] = "123"
profile[:billing][:name] = "Bob Test"
profile[:billing][:address_line1] = "123 Fake St."
profile[:billing][:city] = "Victoria"
profile[:billing][:province] = "BC"
profile[:billing][:country] = "CA"
profile[:billing][:postal_code] = "v1v2v2"
profile[:billing][:phone_number] = "12505551234"
profile[:billing][:email_address] = "fake@example.com"
result = Beanstream.ProfilesAPI.create_profile(profile)
import (
beanstream "github.com/Beanstream/beanstream-go"
"github.com/Beanstream/beanstream-go/paymentMethods"
)
config := beanstream.DefaultConfig()
config.MerchantId = "300200578"
config.PaymentsApiKey = "4BaD82D9197b4cc4b70a221911eE9f70"
gateway := beanstream.Gateway{config}
request := beanstream.PaymentRequest{
PaymentMethod: paymentMethods.CASH,
OrderNumber: "order12345b",
Amount: 12.00}
res, err := gateway.Payments().MakePayment(request)
With this action, you can create a new payment profile tied to one individual, assigning, and validating one or more credit cards.
var profile = {
token: {
name: "Jon Profile",
code: response.token
},
billing: {
name: "Jon Profile",
address_line1: "123 fake street",
city: "victoria",
province: "bc",
postal_code: "V9A3Z4",
country: "ca",
email_address: "fake@example.com",
phone_number:"12345678"
}
};
beanstream.profiles.createProfile(profile)
.then(function(response){
// success
})
.catch(function(error){
console.log(error);
});
$profile_create_token = array(
'billing' => array(
'name' => 'Profile Billing Name',
'email_address' => 'email@email.com',
'phone_number' => '1234567890',
'address_line1' => '456-123 Billing St.',
'city' => 'Shippingville',
'province' => 'BC',
'postal_code' => 'V8J9I5',
'country' => 'CA'
),
'token' => array(
'name' => 'John Doe',
'code' => $singleUseToken
)
);
$profile_id = $beanstream->profiles()->createProfile($profile_create_token);
profile = Beanstream.ProfilesAPI.getCreateProfileWithTokenTemplate()
profile[:token][:name] = "Bob Test"
profile[:token][:code] = token
profile[:billing][:name] = "Bob Test"
profile[:billing][:address_line1] = "123 Fake St."
profile[:billing][:city] = "Victoria"
profile[:billing][:province] = "BC"
profile[:billing][:country] = "CA"
profile[:billing][:postal_code] = "v1v2v2"
profile[:billing][:phone_number] = "12505551234"
profile[:billing][:email_address] = "fake@example.com"
result = Beanstream.ProfilesAPI.create_profile(profile)
request := beanstream.Profile{
Token: beanstream.Token{
Name: "John Doe",
Token: token},
BillingAddress: beanstream.Address{
"John Doe",
"123 Fake St.",
"suite 3",
"Victoria",
"BC",
"CA",
"V8T4M3",
"12505550123",
"test@example.com"}}
res, err := gateway.Profiles().CreateProfile(request)
You can also create a profile with a single-use token instead of a credit card. This is the suggested method of creating profiles since the card number never has to touch your servers, thus lowering your PCI scope.
beanstream.profiles.getProfile(profileId)
.then(function(profile){
// success
})
.catch(function(error){
console.log(error);
});
$result = $beanstream->profiles()->getProfile($profile_id);
result = Beanstream.ProfilesAPI.get_profile(customer_code)
profile, err := gateway.Profiles().GetProfile(profileId)
var updatedProfile = {
billing: {
address_line1: "123 fake street"
}
};
beanstream.profiles.updateProfile(updatedProfile, profileId)
.then(function(response){
// success
})
.catch(function(error){
console.log(error);
});
$profile_data = array(
'billing' => array(
'name' => 'Bobby Bob Jr',
'email_address' => 'email@email.com',
'phone_number' => '1234567890',
'address_line1' => '456-123 Shipping St.',
'city' => 'Shippingville',
'province' => 'BC',
'postal_code' => 'V8J9I5',
'country' => 'CA'
)
);
$result = $beanstream->profiles()->updateProfile($profile_id, $profile_data);
# get profile
profile1 = Beanstream.ProfilesAPI.get_profile(customer_code)
# update profile
profile1['billing']['name'] = "Gizmo test"
profile1['language'] = "en"
profile1['comments'] = "test profile"
profile1['custom']['ref1'] = "i wish"
profile1['custom']['ref2'] = "i was"
profile1['custom']['ref3'] = "an oscar"
profile1['custom']['ref4'] = "mayer"
profile1['custom']['ref5'] = "weiner"
result = Beanstream.ProfilesAPI.update_profile(profile1)
// get profile
profile, err := gateway.Profiles().GetProfile(profileId)
// update profile
profile.BillingAddress.AddressLine1 = "456 Dingle Bingle Road"
res2, err2 := gateway.Profiles().UpdateProfile(profile)
beanstream.profiles.deleteProfile(profileId)
.then(function(response){
// success
})
.catch(function(error){
console.log(error);
});
$result = $beanstream->profiles()->deleteProfile($profile_id);
result = Beanstream.ProfilesAPI.delete_profile(customer_code)
res, err := gateway.Profiles().DeleteProfile(profile.Id)
var card2 = {
name:"Jon Profile",
number:"4030000010001234",
expiry_month:"04",
expiry_year:"20",
cvd:"123"
};
beanstream.profiles.addCard(profileId, card2)
.then(function(response){
// card successfully added
})
.catch(function(error){
console.log(error);
});
$card_data = array(
'card' => array(
'name' => 'Test Testerson',
'number' => '4030000010001234',
'expiry_month' => '07',
'expiry_year' => '22',
'cvd' => '123'
)
);
$result = $beanstream->profiles()->addCard($profile_id, $card_data);
card2 = {
:card => {
:name => "Hilary Test",
:number => "4030000010001234",
:expiry_month => "07",
:expiry_year => "22",
:cvd => "123"
}
}
insert_card = Beanstream.ProfilesAPI.add_profile_card(profile,card2) #profile hash with a 'customer_code' key
card2 := beanstream.CreditCard{
Name: "Jane Doe",
Number: "4030000010001234",
ExpiryMonth: "03",
ExpiryYear: "18",
Cvd: "123"}
res, err := gateway.Profiles().AddCard(profile.Id, card2)
beanstream.profiles.getCards(profileId)
.then(function(cards){
// success
})
.catch(function(error){
console.log(error);
});
$result = $beanstream->profiles()->getCards($profile_id);
card = Beanstream.ProfilesAPI.get_profile_card(profile) #profile: a hash with a 'customer_code' key
cards, err := gateway.Profiles().GetCards(profile.Id)
var updatedCard = {
expiry_year:"20"
};
beanstream.profiles.updateCard(profileId, 2, updatedCard)
.then(function(response){
// success
})
.catch(function(error){
console.log(error);
});
$card_data = array(
'card' => array(
'name' => 'Test Testerson',
'expiry_month' => '07',
'expiry_year' => '22',
'cvd' => '123'
)
);
$result = $beanstream->profiles()->updateCard($profile_id, 1, $card_data); // update the 1st card
updated_card = {
:card => {
:name => "Brent Test",
:expiry_month => "07",
:expiry_year => "20",
:cvd => "123"
}
}
update_card = Beanstream.ProfilesAPI.update_profile_card(profile,1,updated_card) #update card 1
// get card
card, err := profile.GetCard(gateway.Profiles(), 1) // the first card is always #1
// update card
card.ExpiryMonth = "04"
res, err2 := profile.UpdateCard(gateway.Profiles(), *card)
beanstream.profiles.deleteCard(profileId, 2)
.then(function(response){
// success
})
.catch(function(error){
console.log(error);
});
$result = $beanstream->profiles()->deleteCard($profile_id, 2); // delete card #2
delete_card = Beanstream.ProfilesAPI.delete_profile_card(profile,1) #delete card 1
res, err := profile.DeleteCard(gateway.Profiles(), cardId)
You can read the errors returned by the API here.