=== Briqpay B2B Registration Form ===
Contributors: mnording10
Tags: b2b, briqpay, registration, useraccount, user,account
Requires at least: 5.9
Tested up to: 5.9
Requires PHP: 7.4
License: MIT
Stable Tag: 1.0.0
License URI: https://opensource.org/licenses/MIT

Easy account creation for your B2B customers. 

== Description ==
Utilise the Briqpay B2B Registration form to quickly turn visitors to users. Allows you to easily render the Briqpay B2B registration form on your wordpress site
In order to utlize this plugin you need to have an account at Briqpay. Register your own playground account att https://app.briqpay.com

With Briqpay’s B2B registration form you can add a seamless registration to your application process. Creating an account has never been easier.

The registration process differs depending on the industry, market and, other business-critical assessments. Therefore our solutions come with wide flexibility and lots of functionality.

Get validated data, company information, run an automated credit check, e-signature, industry filtering – you’re in control.

Read more at [https://briqpay.com](https://briqpay.com)

== Frequently Asked Questions ==
**How do I find my api key?**
By logging into your merchant account at [https://app.briqpay.com](https://app.briqpay.com)
Dont have a merchant account? No worries, you can get instant access to a playground account by registering your user.

**The plugin rejects all registrations**
You likely havent implemented the correct hook for approving the account validation. Below is example implentnations on how to both validate the application and subsequently create a new user.


`
add_action(
	'init',
	function() {
		add_filter( 'briqpay_signup_completed', 'example_function_to_create_user', 10, 1 );
	}
);
add_action(
	'init',
	function() {
		add_filter( 'briqpay_signup_validation', 'example_filter_functon_for_validation', 10, 2 );
	}
);

function example_function_to_create_user( $signup_data ) {
	$selected_pass = wp_generate_password();
	$user_id       = wp_insert_user(
		array(
			'user_login'   => $signup_data->user->email,
			'user_pass'    => $selected_pass,
			'user_email'   => $signup_data->user->email,
			'first_name'   => $signup_data->user->firstName,
			'last_name'    => $signup_data->user->lastName,
			'display_name' => $signup_data->user->firstName . ' ' . $signup_data->user->lastName,

		)
	);

	$billing_data = array(
		'first_name'        => $signup_data->user->firstName,
		'last_name'         => $signup_data->user->lastName,
		'billing_city'      => $signup_data->address->city,
		'billing_postcode'  => $signup_data->address->zip,
		'billing_email'     => $signup_data->user->email,
		'billing_phone'     => $signup_data->user->phone,
		'billing_company'   => $signup_data->address->companyname,
		'billing_address_1' => $signup_data->address->streetaddress,
	);
	foreach ( $billing_data as $billing_meta_key => $billing_meta_value ) {
			update_user_meta( $user_id, $billing_meta_key, $billing_meta_value );
	}

}


    function example_filter_functon_for_validation( $validaton, $signup_data ) {

	if ( ! get_user_by( 'email', $signup_data->user->email ) ) {
		$validaton = array(
			'result' => true,
			'errors' => array(),
		);
	} else {
		$validaton = array(
			'result' => false,
			'errors' => array(
				array(
					'errorCode'    => 'already_exists',
					'errorField'   => 'email',
					'errorMessage' => 'Found existing user',
				),
			),
		);
	}
	return $validaton;
}
`

**How do I activate the live account?**
You need to have an active subscription plan with Briqpay to utilise our live services.
Contact Briqpay to activate your subscription. [https://briqpay.com/contact-briqpay](https://briqpay.com/contact-briqpay)

**What is Briqpay?**
Briqpay is a technical solution that delivers great user experiences for business-to-business sales online.

Use Briqpays software and API’s to create a seamless customer experience and automate your payment flow, on all markets.
**How can i find Briqpays privacy policy?**
[https://briqpay.com/privacy-policy](https://briqpay.com/privacy-policy)


== Installation ==
download plugin
upload to wp-content
activate in plugins dashboard